public ActionResult <PetColor> Put(int id, [FromBody] PetColor updatePetColor) { if (id != updatePetColor.ID || id == 0) { return(BadRequest("Ids must match, and they can't be 0. What are you even doing now!")); } else if (string.IsNullOrEmpty(updatePetColor.NameOfPetColor)) { return(BadRequest("Write a name for the updated color, pal!")); } else { try { return(Accepted(_petColorService.UpdatePetColor(updatePetColor))); } catch (Exception e) { return(StatusCode(500, e.Message)); } } }
public ActionResult <PetColor> Put(int id, [FromBody] PetColor theUpdatedPetColor) { if (id != theUpdatedPetColor.PetColorId || id == 0) { return(BadRequest("The Id's must match, and may not be 0.")); } else if (string.IsNullOrEmpty(theUpdatedPetColor.PetColorName)) { return(BadRequest("You need to enter a name for the updated color.")); } else { try { return(Accepted(_petColorService.UpdatePetColor(theUpdatedPetColor))); } catch (Exception e) { return(StatusCode(500, e.Message)); } } }