コード例 #1
0
 public ActionResult <PetType> Get(int id)
 {
     try
     {
         return(_petTypeService.GetById(id));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #2
0
 public ActionResult <PetType> Get(int id)
 {
     try
     {
         var result = _petTypeService.GetById(id);
         if (result == null)
         {
             return(NotFound());
         }
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, $"Process failed!!??:( Exception Message:{ex.Message}"));
     }
 }