public HttpResponseMessage Get() { try { var listarPatrimonios = _patrimonioRepository.GetPatrimonios(); return(Request.CreateResponse(HttpStatusCode.OK, listarPatrimonios, "application/json")); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message, "application/json")); } }
public IActionResult GetPatrimonios() { var objList = _patrepo.GetPatrimonios(); var objDTo = new List <Patrimonio>(); foreach (var obj in objList) { objDTo.Add(_mapper.Map <Patrimonio>(obj)); } return(Ok(objDTo)); }