Exemplo n.º 1
0
 public Response <IList <Pais> > Handle(GetAllPaisesQuery request)
 {
     try
     {
         return(new Response <IList <Pais> >(data: _context.Pais.ToList()));
     }
     catch
     {
         return(new Response <IList <Pais> >(message: $"error to get"));
     }
 }
Exemplo n.º 2
0
        public async Task <ActionResult <Response <IList <Pais> > > > Create(
            [FromServices] IGetAllPaisesQueryHandler handler,
            [FromQuery] GetAllPaisesQuery command
            )
        {
            var response = handler.Handle(command);

            if (!response.Succeeded)
            {
                return(NotFound());
            }

            return(Created(
                       HttpRequestHeader.Referer.ToString(),
                       response
                       ));
        }