Esempio n. 1
0
        public static void ShowItemsByPriceInterval(ref RestaurantManager restaurantManager)
        {
            Console.WriteLine("Enter the first price:");
            string firstPriceStr = Console.ReadLine();
            double firstPrice;

            while (!double.TryParse(firstPriceStr, out firstPrice) || firstPrice < 0)
            {
                Console.WriteLine("Error! Enter the price correctly!");
                firstPriceStr = Console.ReadLine();
            }
            Console.WriteLine("Enter the second price:");

            string secondPriceStr = Console.ReadLine();
            double secondPrice;

            while (!double.TryParse(secondPriceStr, out secondPrice) || secondPrice < 0)
            {
                Console.WriteLine("Error! Enter the price correctly!");
                secondPriceStr = Console.ReadLine();
            }
            List <MenuItem> itemsCategory = restaurantManager.GetMenuItemsPriceInterval(firstPrice, secondPrice);

            foreach (var item in itemsCategory)
            {
                Console.WriteLine($"Name; {item.Name}\nNo: {item.Name}\nCategory: {item.Category}\nPrice: {item.Price}");
            }
        }