public IHttpActionResult PutRoom(int id, Room room) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != room.RoomNumber) { return(BadRequest()); } db.Entry(room).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RoomExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Update(T entity) { dbSet.Attach(entity); roomManagerEntities.Entry(entity).State = EntityState.Modified; Save(); }