Esempio n. 1
0
 public void ShowAllProducts()
 {
     Stock.ShowAll();
 }
Esempio n. 2
0
        public static void ShowMenu()
        {
            while (true)
            {
                Console.WriteLine("Choo-o-oose you de-e-stinyy-y!!! (only in this program, not in general):");
                Console.WriteLine("1. Manager");
                Console.WriteLine("2. Customer");

                var isLogin  = false;
                var answer   = Console.ReadLine();
                var customer = new Customer();

                if (answer == "1" || answer == "2")
                {
                    isLogin = true;
                }
                else
                {
                    Console.WriteLine("Please, enter the digit corresponding to the command");
                }

                while (isLogin)
                {
                    Console.WriteLine("Choose action: ");

                    switch (answer)
                    {
                    case "1":
                        Console.WriteLine("1. Show products\n2. Add product\n3. Delete product\n0. Change destiny");
                        break;

                    case "2":
                        Console.WriteLine("1. Show products\n2. Buy product\n0. Change destiny");
                        break;

                    default:
                        isLogin = false;
                        break;
                    }

                    switch (Console.ReadLine())
                    {
                    case "0": isLogin = false;
                        break;

                    case "1":
                        Stock.ShowAll();
                        break;

                    case "2" when answer == "1":
                        Manager.AddProduct(CreateProduct());
                        break;

                    case "2":
                        Console.WriteLine($"Available money: {customer.Money}");
                        Controller.BuyProduct(out var title, out var quantity);
                        customer.BuyProduct(title, quantity);
                        break;

                    case "3" when answer == "1":
                        Manager.DestroyProduct(Controller.DeleteProduct());
                        break;

                    default: Console.WriteLine("Please, enter the digit corresponding to the command");
                        break;
                    }
                }
            }
        }