public IActionResult GetAll() { try { var result = _app.GetAll(); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public virtual Task <IActionResult> Get([ModelBinder] QueryFilter filter, bool paginado = true) { if (!paginado) { return(Task.FromResult <IActionResult>(Ok(Mapper.Map <IList <TViewModel> >(_application.GetAll(filter))))); } var dados = _application.GetPaginated(filter, filter.Start, filter.Limit); var viewModel = Mapper.Map <IList <TViewModel> >(dados.Data); return(Task.FromResult <IActionResult>(Ok(new Result <IList <TViewModel> >(viewModel, dados.Total)))); }