public async Task <bool> UpdatePetType(int petTypeId, string petTypeDesc) { var petType = await _petTypeService.GetPetType(petTypeId); petType.PetTypeDesc = petTypeDesc; return(await _petTypeService.UpdatePetType(petType)); }
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")); } }
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)); } }
public ActionResult <IEnumerable <PetType> > Get() { return(Ok(_petTypeService.GetPetType())); }