コード例 #1
0
ファイル: GorivoController.cs プロジェクト: bd210/oglasi
 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));
     }
 }
コード例 #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));
     }
 }