コード例 #1
0
 public ActionResult <TypePet> Get(int id)
 {
     try
     {
         if (id < 1)
         {
             return(BadRequest("Id must be greater than 0"));
         }
         else if (_typePetService.getTypeById(id) == null)
         {
             return(NotFound());
         }
         else
         {
             return(_typePetService.getTypeById(id));
         }
     }
     catch (System.Exception)
     {
         return(StatusCode(500, "Error when looking for a pet type by ID"));
     }
 }
コード例 #2
0
 public ActionResult <TypePet> Get(int id)
 {
     return(_typePetService.getTypeById(id));
 }