public async Task <IActionResult> PutCat(int id, AnimalCrossing.Models.Cat cat) { if (id != cat.CatId) { return(BadRequest()); } _context.Entry(cat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Put(int id, [FromBody] Animal animal) { animal.AnimalId = id; _db.Entry(animal).State = EntityState.Modified; _db.SaveChanges(); }