Beispiel #1
0
        public ActionResult CreateHall([FromBody] HallViewModel model)
        {
            // model.Purpose=m
            var hallmanager = new Hallmanager(uow);

            hallmanager.CreateHall(model);
            return(Ok());
        }
Beispiel #2
0
        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());
        }