Esempio n. 1
0
        public IActionResult GetTimeSlots()
        {
            PickUpTimeViewModel result = _cartRepository.GetTimeSlots(null);
            var route = "~/Views/ShoppingCart/PickUpTime.cshtml";

            return(PartialView(route, result));
        }
Esempio n. 2
0
        public PickUpTimeViewModel GetTimeSlots(string bookingId)
        {
            bookingId = bookingId ?? _cartSession.BookingId;
            var prepTime     = GetPreparationTime(bookingId);
            var discount     = GetDiscount(bookingId);
            var model        = _calendarRepository.GetPickUpOption(prepTime, discount).Take(50);
            var selectedTime = GetPickUpDate(bookingId);
            var result       = new PickUpTimeViewModel
            {
                TimeSlots     = model.Where(x => !(x.Key == selectedTime.From && x.Value == selectedTime.To)),
                SelectedTime  = new KeyValuePair <DateTime, TimeSpan>(selectedTime.From, selectedTime.To),
                Message       = selectedTime.Message,
                UserSubmitted = selectedTime.UserSubmitted
            };

            return(result);
        }