public IHttpActionResult PostBookingRecordDetail(BookingRecordDetail bookingRecordDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BookingRecordDetails.Add(bookingRecordDetail); try { db.SaveChanges(); } catch (DbUpdateException) { if (BookingRecordDetailExists(bookingRecordDetail.BookingRecordDetail_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = bookingRecordDetail.BookingRecordDetail_ID }, bookingRecordDetail)); }
public IHttpActionResult PutBookingRecordDetail(int id, BookingRecordDetail bookingRecordDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bookingRecordDetail.BookingRecordDetail_ID) { return(BadRequest()); } db.Entry(bookingRecordDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookingRecordDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetBookingRecordDetail(int id) { BookingRecordDetail bookingRecordDetail = db.BookingRecordDetails.Find(id); if (bookingRecordDetail == null) { return(NotFound()); } return(Ok(bookingRecordDetail)); }
public IHttpActionResult DeleteBookingRecordDetail(int id) { BookingRecordDetail bookingRecordDetail = db.BookingRecordDetails.Find(id); if (bookingRecordDetail == null) { return(NotFound()); } db.BookingRecordDetails.Remove(bookingRecordDetail); db.SaveChanges(); return(Ok(bookingRecordDetail)); }