public async Task <IHttpActionResult> PostNoOfBookingsGuest(NoOfBookingsGuest noOfBookingsGuest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NoOfBookingsGuest.Add(noOfBookingsGuest); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (NoOfBookingsGuestExists(noOfBookingsGuest.Guest_No)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = noOfBookingsGuest.Guest_No }, noOfBookingsGuest)); }
public async Task <IHttpActionResult> PutNoOfBookingsGuest(int id, NoOfBookingsGuest noOfBookingsGuest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != noOfBookingsGuest.Guest_No) { return(BadRequest()); } db.Entry(noOfBookingsGuest).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoOfBookingsGuestExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetNoOfBookingsGuest(int id) { NoOfBookingsGuest noOfBookingsGuest = await db.NoOfBookingsGuest.FindAsync(id); if (noOfBookingsGuest == null) { return(NotFound()); } return(Ok(noOfBookingsGuest)); }
public async Task <IHttpActionResult> DeleteNoOfBookingsGuest(int id) { NoOfBookingsGuest noOfBookingsGuest = await db.NoOfBookingsGuest.FindAsync(id); if (noOfBookingsGuest == null) { return(NotFound()); } db.NoOfBookingsGuest.Remove(noOfBookingsGuest); await db.SaveChangesAsync(); return(Ok(noOfBookingsGuest)); }