Esempio n. 1
0
        public static void EditMenuItem(ref RestaurantManager restaurantManager)
        {
            Console.WriteLine("Enter the number you want to change:");
            string editStr = Console.ReadLine();

            while (string.IsNullOrWhiteSpace(editStr))
            {
                Console.WriteLine("Error! Enter the number correctly!");
                editStr = Console.ReadLine();
            }
            Console.WriteLine("Enter the price you want to change:");
            string priceStr = Console.ReadLine();
            double price;

            while (!double.TryParse(priceStr, out price) || price < 0)
            {
                Console.WriteLine("Error! Enter the price correctly!");
                priceStr = Console.ReadLine();
            }
            Console.WriteLine("Enter the name you want to change:");
            string itemName = Console.ReadLine();

            while (string.IsNullOrWhiteSpace(itemName))
            {
                Console.WriteLine("Error! Enter the item name correctly!");
                itemName = Console.ReadLine();
            }

            restaurantManager.EditMenuItem(itemName, price, editStr);
        }