コード例 #1
0
 public ActionResult <TypePet> Put(int id, [FromBody] TypePet typePet)
 {
     if (id < 0 || typePet.Id != id)
     {
         return(BadRequest("invalid ID input"));
     }
     _typePetService.Update(typePet);
     return(StatusCode(500, "Update successful"));
 }
コード例 #2
0
 public ActionResult <TypePet> Put(int id, [FromBody] TypePet typePet)
 {
     try
     {
         if (typePet.Id != id || id < 0)
         {
             return(BadRequest("ID Error! Please check id"));
         }
         _typePetService.Update(typePet);
         return(StatusCode(200, "Yes Sir! Pet type is updated."));
     }
     catch (System.Exception)
     {
         return(StatusCode(500, "Error when updating pet type"));
     }
 }