Exemple #1
0
        public async Task <IActionResult> OnPost()
        {
            var token = HttpContext.GetToken();

            NewDelivery.DeliveryItems = new List <DeliveryItem>();
            NewDelivery.DeliveryItems.Add(DeliveryItem);

            await _deliveryService.AddDelivery(NewDelivery, token);

            return(RedirectToPage("/Delivery/Index"));
        }
        private void BtnSend_Click(object sender, RoutedEventArgs e)
        {
            switch (_selectedType)
            {
            case PackageType.Mini:
                totalTravelTime     = Convert.ToInt32(nNumberTraveltime.Text);
                selectedPackageType = PackageType.Mini.ToString();
                break;

            case PackageType.Standaard:
                totalTravelTime     = (Convert.ToInt32(nNumberTraveltime.Text)) * 1.2;
                selectedPackageType = PackageType.Standaard.ToString();
                break;

            case PackageType.Maxi:
                totalTravelTime     = (Convert.ToInt32(nNumberTraveltime.Text)) * 1.5;
                selectedPackageType = PackageType.Maxi.ToString();
                break;
            }

            if (chkPriority.IsChecked == true)
            {
                checkIfPrior      = true;
                _selectedPriority = PackageType.priority;
            }
            else
            {
                checkIfPrior      = false;
                _selectedPriority = PackageType.regular;
            }


            DeliveryService.AddDelivery(new Delivery()
            {
                PackageType = _selectedType,
                TravelTime  = totalTravelTime,
                Priority    = checkIfPrior,
                PriorType   = _selectedPriority
            });

            rbtnStandaard.IsChecked = true;
            rbtnMini.IsChecked      = false;
            rbtnMaxi.IsChecked      = false;

            //Select first delivery in the list
            if (this.lstDeliveries.Items.Count > 0)
            {
                this.lstDeliveries.SelectedIndex = 0;
            }

            UpdateGuiThread(() => lstDeliveries.Items.Refresh());
        }
Exemple #3
0
        public async Task <IActionResult> AddDelivery([FromBody] int BookingId)
        {
            object detailsExist = await _deliveryService.AddDelivery(BookingId);

            return(new OkObjectResult(detailsExist));
        }