Esempio n. 1
0
        private static void ReturningCustomer()
        {
            bool localrestart = false;

            Console.WriteLine("Please input your CustomerID!");
            int choice = Common.Answer();

            do
            {
                Customer Customer = PizzaBoxContext.DataReadID <Customer>(choice, _context.Customers);
                if (Customer is null)
                {
                    Console.WriteLine("We couldnt find a customer with that ID! :( Try another, or enter 0 to return!");
                    choice = Common.Answer();
                    if (choice == 0)
                    {
                        localrestart = false;
                        StartOrder();
                    }
                    else
                    {
                        localrestart = true;
                    }
                }
                else
                {
                    Console.WriteLine($"{Customer.Name}, welcome back!");
                    OrderCreation(Customer);
                }
            } while (localrestart);
        }
Esempio n. 2
0
        private static void OrderCreation(Customer Customer)
        {
            Order MyOrder = new Order();

            MyOrder.Customer = Customer;
            bool localrestart = false;

            Console.WriteLine("Which store will you be purchasing from?");
            PrintStoreList();
            switch (Common.Answer(1, 3))
            {
            case 1:
            {
                MyOrder.Store = PizzaBoxContext.DataReadID(1, _context.Stores);

                break;
            }

            case 2:
            {
                MyOrder.Store = PizzaBoxContext.DataReadID(2, _context.Stores);

                break;
            }

            case 3:
            {
                MyOrder.Store = PizzaBoxContext.DataReadID(3, _context.Stores);

                break;
            }
            }
            do
            {
                MyOrder.AddPizza(PizzaCreator());
                Console.WriteLine(@"Would you like to add another pizza?
1: Yes
2: No
");
                if (Common.Answer(1, 2) == 1)
                {
                    localrestart = true;
                }
                else
                {
                    localrestart = false;
                }
            } while (localrestart);
            ConfirmOrder(MyOrder);
        }