Beispiel #1
0
        public async Task CheckOut()
        {
            SaleModel sale = new SaleModel();

            foreach (var item in Cart)
            {
                sale.SaleDetails.Add(new SaleDetailModel
                {
                    ProductId = item.Product.Id,
                    Quantity  = item.QuantityInCart
                });
            }

            await _saleEndpoint.PostSale(sale);
        }
        public async Task CheckOut()
        {
            //Create a Sale Model and post to API
            SaleModel sale = new SaleModel();

            foreach (var item in Cart)
            {
                sale.SaleDetails.Add(new SaleDetailModel
                {
                    ProductId = item.Product.Id,
                    Quantity  = item.QuantityInCart
                });
            }
            await _saleEndPoint.PostSale(sale);

            await ResetSalesViewModel();
        }
        public async void CheckOut()
        {
            //create a sale model and post to the api
            SaleModel Sale = new SaleModel();

            foreach (var item in Cart)
            {
                Sale.SaleDetails.Add(new SaleDetailModel
                {
                    ProductID = item.Product.Id,
                    Quantity  = item.QuantityInCart
                });
            }

            await _saleEndPoint.PostSale(Sale);

            await ResetSalesViewModel();
        }
        public async Task CheckOut()
        {
            // Create a SaleModel and post to the API
            SaleModel sale = new SaleModel();

            foreach (var item in Cart) // Adding the parallel foreach would speed up the process
            {
                sale.SaleDetails.Add(new SaleDetailModel
                {
                    ProductId = item.Product.Id,
                    Quantity  = item.QuantityInCart
                });
            }
            // Add exception handlers
            // call api
            await _saleEndpoint.PostSale(sale);

            // reset the page so the products are updated after sale
            await ResetSalesViewModel();
        }