Example #1
0
        public string GetDeep()
        {
            DeepDish deep    = new DeepDish();
            string   message = deep.Cook();

            return(message);
        }
Example #2
0
        public Order OrderFromStore(Store store, User user)
        {
            System.Console.WriteLine($"Based on your location, you'll be ordering from the store at {store.StoreLocation.Address1}.");

            System.Console.WriteLine("What kind of pizza do you want?");
            System.Console.WriteLine("New York Style or Deep Dish Style");
            var type = System.Console.ReadLine();

            while (store.Inventory.OfType <Crust>().FirstOrDefault(t => t.Name == type) == null)
            {
                System.Console.WriteLine("That's not in the options.");
                System.Console.WriteLine("What kind of pizza do you want?");

                type = System.Console.ReadLine();
            }

            System.Console.WriteLine("What size would you like?");
            System.Console.WriteLine("Small, Medium, Large, or X-Large");
            var size = System.Console.ReadLine();

            while (_possibleSizes.FirstOrDefault(s => s.Name == size) == null)
            {
                System.Console.WriteLine("That's not a valid size.");
                System.Console.WriteLine("What size would you like (Small, Medium, Large, X-Large)?");

                size = System.Console.ReadLine();
            }

            System.Console.WriteLine("What kind of toppings do you want? (you'll only be able to have up to 5 and all pizzas come with pepperoni and mozzarella cheese)");
            System.Console.WriteLine("Mushroom, Sausage, Canadian Bacon");
            var topping = System.Console.ReadLine();

            while (store.Inventory.OfType <Topping>().FirstOrDefault(t => t.Name == topping) == null)
            {
                System.Console.WriteLine("That's not in the options.");
                System.Console.WriteLine("What kind of toppings do you want?");

                topping = System.Console.ReadLine();
            }

            var selectedToppings = new List <Topping> {
                store.Inventory.OfType <Topping>().FirstOrDefault(t => t.Name == topping)
            };

            if (type == "Deep Dish Style")
            {
                var deepDish = new DeepDish();
                List <AIngredient> pi;
                decimal            total;

                deepDish.Make(store, _possibleSizes.FirstOrDefault(s => s.Name == size), selectedToppings, out pi, out total);

                System.Console.WriteLine("Order created!");

                return(new Order(store, user, new List <List <AIngredient> > {
                    pi
                }));
            }

            var nyStyle = new NewYork();
            List <AIngredient> pizza;
            decimal            cost;

            nyStyle.Make(store, _possibleSizes.FirstOrDefault(s => s.Name == size), selectedToppings, out pizza, out cost);

            System.Console.WriteLine("Order created!");

            return(new Order(store, user, new List <List <AIngredient> > {
                pizza
            }));
        }