コード例 #1
0
        private static void OpenProductHandlerMenu()
        {
            bool shouldBeOpen = true;

            while (shouldBeOpen)
            {
                Console.Clear();

                PrintProductHandlerMenu();

                string userInput = Console.ReadLine();

                if (userInput == "0")
                {
                    shouldBeOpen = false;
                }
                else if (userInput == "1")
                {
                    ProductHandler.ListAll();
                    ReturnToMenu();
                }
                else if (userInput == "2")
                {
                    ProductHandler.Create();
                    ReturnToMenu();
                }
                else if (userInput == "3")
                {
                    ProductHandler.Delete();
                    ReturnToMenu();
                }
                else if (userInput == "4")
                {
                    ProductHandler.Edit();
                    ReturnToMenu();
                }
                else
                {
                    PrintInvalidChoice();
                }
            }
        }