public async Task <IActionResult> UpdateFarm(int id, Farm farm) { if (id != farm.FarmId) { return(BadRequest()); } _context.Entry(farm).State = EntityState.Modified; try { await _context.SaveChangesAsync(); return(new JsonResult(farm)); } catch (DbUpdateConcurrencyException) { if (!FarmExists(id)) { return(NotFound()); } else { throw; } } }
public async Task <IActionResult> UpdateAnimal(int id, Animal animal) { if (id != animal.AnimalId) { return(BadRequest()); } _context.Entry(animal).State = EntityState.Modified; try { await _context.SaveChangesAsync(); return(new JsonResult(animal)); } catch (DbUpdateConcurrencyException) { if (!AnimalExists(id)) { return(NotFound()); } else { throw; } } }