Exemplo n.º 1
0
 public ActionResult <GorivoDto> Get(int id)
 {
     try
     {
         var gorivo = _getFuelCommand.Execute(id);
         return(Ok(gorivo));
     }
     catch (EntityNotFoundException e)
     {
         if (e.Message == "Gorivo doesn't exist.")
         {
             return(NotFound(e.Message));
         }
         return(UnprocessableEntity(e.Message));
     }
 }
Exemplo n.º 2
0
 public ActionResult <FuelShow> Get(int id)
 {
     try
     {
         return(Ok(_get.Execute(id)));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(StatusCode(500));
     }
 }