Exemple #1
0
        public void switchChoiceInShop()
        {
            int choiceUser = ChoiceMainSection();

            while (choiceUser != 0)
            {
                if (choiceUser == 1)
                {
                    StoryView.StoryShop();
                    if (backToMenu() == "q")
                    {
                        break;
                    }
                }
                else if (choiceUser == 2)
                {
                    ShopCartView.printInventory();
                    if (backToMenu() == "q")
                    {
                        choiceUser = 0;
                        continue;
                    }
                    else
                    {
                        Console.WriteLine("If you want buy some product enter correct ProductName to add items to your basket");
                        int IdProduct = ProductController.GetIdPurchaseProduct();
                        if (productController.UpadateQuntityProductDatabase(IdProduct) == false)
                        {
                            continue;
                        }
                        else
                        {
                            basket.AddProductToBasket(IdProduct);
                            break;
                        }
                    }
                }
                else if (choiceUser == 3)
                {
                    basket.printBasket();
                    Console.WriteLine("It is your basket.");
                    Console.WriteLine("1) You may remove product \n2)Buy");

                    if (backToMenu() == "q")
                    {
                        choiceUser = 0;
                        continue;
                    }
                    else
                    {
                        string choice = Console.ReadLine();
                        if (choice == "1")
                        {
                            Console.WriteLine("Which product do you want remove?");
                            string removeProduct = Console.ReadLine();

                            basket.startRemoveProduct(removeProduct);
                            choiceUser = 3;
                            continue;
                        }
                        else
                        {
                            order.AddOrderToDatabase();
                            Console.WriteLine("Thanks for your order. See you soon!");
                            continue;
                        }
                    }
                }

                else if (choiceUser == 4)
                {
                    choiceUser = 0;
                    break;
                }

                continue;
            }
        }