Esempio n. 1
0
        public IActionResult Booking(Booking createdBooking, DateTime date, DateTime time)
        {
            createdBooking.Time = date + time.TimeOfDay;

            BookingStatus status;
            var           goat = "goat";

            if (DateTime.Now > createdBooking.Time)
            {
                status = BookingStatus.InPast;
            }
            else if (holidayService.IsConflict(createdBooking))
            {
                status = BookingStatus.OnHoliday;
            }
            else
            {
                status = bookingService.AddBooking(createdBooking);
            }

            if (status == BookingStatus.BookingMade)
            {
                return(View("Confirmation", createdBooking));
            }

            ModelState.AddModelError(string.Empty, BookingErrorMessageLookup[status]);
            return(View(createdBooking));
        }