Esempio n. 1
0
        public void placeOrder()
        {
            IDominosApi api             = new DominosApi.DominosApi();
            var         htype           = (addrType == "House") ? Address.UnitCategory.House : Address.UnitCategory.Apartment;
            var         deliveryAddress = new Address(addr, town, state, zip, htype);
            var         customerInfo    = new Customer(customerFirstName, customerLastName, deliveryAddress, customerEmail, customerPhoneNumber);

            /*
             *
             * string storeId = "3712";    // Get this value from a call to SearchLocations(...)
             *
             * // Two medium pepperoni pizzas, one medium cheese, and cinnastix
             * var products = new List<Product> {  new Product("14SCREEN", 2, new List<string> { "C", "P", "X" }),
             * new Product("14SCREEN", 1, new List<string> { "C", "X" }),
             * new Product("CINNASTIX8", 1)};
             *
             * var coupons = new List<Coupon> { new Coupon("3510", 1) };   // This particular coupon saves us money on three medium pizzas.
             *                                  // Get this value from a call to GetMenu(...)
             *
             * var myOrder = new Order(customerInfo, storeId, products, coupons);
             *
             * var pricedOrder = await api.PriceOrder(myOrder);   // This may throw if, for instance, the store is closed.
             *
             * decimal totalAmountToPay = pricedOrder.Order.Amounts.Payment.Value;
             *
             * var payments = new List<Payment> { new Payment("1112223334444", CreditCardType.Visa, "0918", "111", "02170", totalAmountToPay) };
             *
             * var order = await api.PlaceOrder(myOrder, payments);
             */
        }
Esempio n. 2
0
        private async Task <int> getNearestStoreAsync()
        {
            IDominosApi api             = new DominosApi.DominosApi();
            var         deliveryAddress = new Address(Pizza.addr, Pizza.town, Pizza.state, Pizza.zip, Address.UnitCategory.House);
            var         locationData    = await api.SearchLocations(deliveryAddress);

            int?nearestStoreID = locationData.Stores.OrderBy(x => x.MinDistance)
                                 .FirstOrDefault(x => x.ServiceIsOpen?.Delivery.Value ?? false)?.StoreID;

            return(nearestStoreID.Value);
        }