Example #1
0
        public async Task <bool> UpdatePetType(int petTypeId, string petTypeDesc)
        {
            var petType = await _petTypeService.GetPetType(petTypeId);

            petType.PetTypeDesc = petTypeDesc;
            return(await _petTypeService.UpdatePetType(petType));
        }
Example #2
0
        public ActionResult <PetType> Get(int id)
        {
            try
            {
                PetType t = _petTypeService.GetPetType(id);
                if (t == null)
                {
                    return(StatusCode(404, "pet not found"));
                }

                return(Ok(t));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "something went wrong"));
            }
        }
Example #3
0
 public ActionResult <PetType> Get(int id)
 {
     try
     {
         return(_petTypeService.GetPetType(id));
     }
     catch (KeyNotFoundException e)
     {
         return(StatusCode(404, e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Example #4
0
        public ActionResult <IEnumerable <PetType> > Get()

        {
            return(Ok(_petTypeService.GetPetType()));
        }