Пример #1
0
        private static void CustomerHistory()
        {
            bool localrestart = false;

            Console.WriteLine("Whose order history would you like to check?");
            int choice = Common.Answer();

            do
            {
                List <Order> History = PizzaBoxContext.CustomerHistory(_context, choice);
                if (History 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;
                        DoTheThing();
                    }
                    else
                    {
                        localrestart = true;
                    }
                }
                else
                {
                    if (History[0].Customer.Name != null)
                    {
                        Console.WriteLine($"History for {History[0].Customer.Name}:");
                    }
                    foreach (var item in History)
                    {
                        Console.WriteLine($"\nOrder ID:{item.EntityID} - {item.Store.name} - {item.OrderTotal} containing:");
                        for (int i = 0; i < item.Items.Count; i++)
                        {
                            Console.WriteLine($"{item.Items[i].ToStringName()} {item.Items[i].ToStringALL()}");
                        }
                    }
                }
            } while (localrestart);
        }