Exemplo n.º 1
0
 public async Task <ActionResult <Zoo> > Patch(
     int id,
     [FromBody] Zoo animal)
 {
     // If model is not valid, return the problem
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     if (id != animal.Id)
     {
         return(BadRequest());
     }
     try
     {
         await _repo.Update(animal);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(NotFound());
     }
     return(NoContent());
 }