Esempio n. 1
0
 public IActionResult GetAll()
 {
     try
     {
         var result = _app.GetAll();
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 2
0
        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))));
        }