/**
         * Method to check if two suplliers is in the same time range
         * return false if they are not in the same time range
         */
        private async Task <bool> CheckIfSupplierTimeOverlap(BookingViewModel bookingViewModel, OrderViewModel orderViewModel)
        {
            var orderViewModelsInCurrentBooking = new List <SupplierViewModel>();

            foreach (var order in bookingViewModel.OrdersListViewModel)
            {
                orderViewModelsInCurrentBooking.Add(await _supplierDataService.GetSupplierById(order.SupplierViewModel.SupplierId));
            }

            var SupplierTryingToBook = await _supplierDataService.GetSupplierById(orderViewModel.SupplierViewModel.SupplierId);

            orderViewModelsInCurrentBooking.OrderBy(x => x.DeliveryStart);

            bool overlap = true;

            foreach (var supplier in orderViewModelsInCurrentBooking)
            {
                if (!Overlap(SupplierTryingToBook, supplier))
                {
                    overlap = false;
                    break;
                }
            }

            return(overlap);
        }
Beispiel #2
0
        public async Task <IActionResult> OnGetAsync(Guid id)
        {
            SupplierViewModel = await _supplierDataService.GetSupplierById(id);


            return(Page());
        }