Example #1
0
 public ActionResult <PetType> Get(int id)
 {
     try
     {
         return(Accepted(petTypeService.GetPetTypeById(id)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
 public ActionResult <PetType> Get(int id)
 {
     try
     {
         PetType petType = _petTypeService.GetPetTypeById(id);
         if (petType == null)
         {
             return(StatusCode(404, "did not find petType"));
         }
         return(Ok(petType));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(StatusCode(500, e));
     }
 }
Example #3
0
 public ActionResult <PetType> Get(int id)
 {
     try
     {
         var petType = _petTypesService.GetPetTypeById(id);
         if (petType == null)
         {
             return(StatusCode(404, $"Did not find pet type with ID {id}"));
         }
         else
         {
             return(Ok(petType));
         }
     }
     catch (InvalidDataException e)
     {
         return(StatusCode(500, e.Message));
     }
     catch (Exception)
     {
         return(StatusCode(500, ExceptionMessageConstants.NonSpecificUIMessage));
     }
 }
Example #4
0
 public PetType GetPetsType(int id)
 {
     return(_petTypeService.GetPetTypeById(id));
 }