public IHttpActionResult PutRoom(Room room) { int id = room.RoomID; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != room.RoomID) { 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 IHttpActionResult PutHotelPayment(HotelPayment hotelPayment) { int id = hotelPayment.HotelPaymentId; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hotelPayment.HotelPaymentId) { return(BadRequest()); } db.Entry(hotelPayment).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HotelPaymentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutCar(Car car) { int id = car.CarId; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != car.CarId) { return(BadRequest()); } db.Entry(car).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CarExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAirline(Airline airline) { int id = airline.AirlineId; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != airline.AirlineId) { return(BadRequest()); } db.Entry(airline).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AirlineExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }