예제 #1
0
 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"));
     }
 }
예제 #2
0
        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));
        }