public Response <IList <Estado> > Handle(GetAllEstadosQuery request) { try { return(new Response <IList <Estado> >(_context.Estado.Include(e => e.Pais).ToList())); } catch { return(new Response <IList <Estado> >(message: $"error to get")); } }
public async Task <ActionResult <Response <IList <Estado> > > > Create( [FromServices] IGetAllEstadosQueryHandler handler, [FromQuery] GetAllEstadosQuery command ) { var response = handler.Handle(command); if (!response.Succeeded) { return(NotFound()); } return(Created( HttpRequestHeader.Referer.ToString(), response )); }