public IHttpActionResult PutHotelRooms(int id, HotelRooms hotelRooms) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hotelRooms.Hotel_No) { return(BadRequest()); } db.Entry(hotelRooms).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HotelRoomsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutGuestlist(string id, Guestlist guestlist) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != guestlist.HotelName) { return(BadRequest()); } db.Entry(guestlist).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GuestlistExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }