public ActionResult CreateHall([FromBody] HallViewModel model) { // model.Purpose=m var hallmanager = new Hallmanager(uow); hallmanager.CreateHall(model); return(Ok()); }
public ActionResult Book([FromBody] BookingModel bookingModel) { Hallmanager hallmanager = new Hallmanager(uow); var booking = uow.Bookings.GetAll().Where(x => x.HallID == bookingModel.HallID && (bookingModel.StartTime <= x.EndTime && bookingModel.StartTime >= x.StartTime || x.StartTime <= bookingModel.EndTime && x.StartTime >= bookingModel.StartTime)).FirstOrDefault(); if (booking != null) { return(BadRequest("The hall is unavailable at this time, please choose another date or time")); } hallmanager.BookHall(bookingModel); return(Ok()); }