public async Task <IActionResult> PutUser(int id, User user) { if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task<IActionResult> PutHouse(int id, House house) { if (id != house.Id) { return BadRequest(); } _context.Entry(house).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HouseExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }