public IHttpActionResult getAll(string name = "none") { try { List <t_catalogo> catalogo = new List <t_catalogo>(); if (name.Equals("none")) { catalogo = repository.GetAll().ToList(); } else { catalogo = repository.FindBy(x => x.tx_descripcion == name).ToList(); } //var catalogo = repository.GetAll(); List <Catalogo> catalogoDto = catalogo.Select(Mapper.Map <t_catalogo, Catalogo>).ToList(); response = catalogoDto; return(Ok(response)); } catch (Exception ex) { response.Status = Constants.ResponseStatus.error; response.Message = Constants.ErrorMessage.internal_server_error; return(Content(HttpStatusCode.InternalServerError, response)); } }
public ActionResult Index() { List <Catalogo> catalogos = catalogoService.GetAll().ToList(); return(View(catalogos)); }