public ActionResult <List <Provincia> > GetAll() { try { DataContext dataContext = new DataContext(); ProvinciaService provinciaService = new ProvinciaService(dataContext); var lista = provinciaService.GetAll(); if (lista == null) { return(NotFound()); } return(lista); } catch (Exception e) { return(BadRequest(Tools.ExceptionMessage(e))); } }
public async Task <JsonResult> Get() { return(Json(Mapper.Map <List <ProvinciaDTO> >(await ProvinciaService.GetAll()), JsonRequestBehavior.AllowGet)); }