public IHttpActionResult CancelReservation(int reservationId) { Reservation reservation = ReservationsAdapter.QueryReservation(reservationId); if (reservation == null) { return(BadRequest("This reservation does not exist!")); } ReservationsAdapter.CancelReservation(reservation); return(Ok()); }
public IHttpActionResult CompleteReservation(int reservationId, int quantity) { Reservation reservation = ReservationsAdapter.QueryReservation(reservationId); if (reservation == null) { return(BadRequest("This reservation does not exist!")); } int freeSeats = reservation.Projection.FreeSeats; if (quantity > freeSeats) { return(BadRequest("Number of seats exceeded!")); } ReservationsAdapter.CompleteReservation(reservation, quantity); return(Ok()); }