Exemplo n.º 1
0
        public static void ShowOrdersPriceInterval(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 <Order> orderPrice = restaurantManager.GetOrdersByPriceInterval(firstPrice, secondPrice);

            foreach (var item in orderPrice)
            {
                Console.WriteLine($"No: {item.No}\nTotal Amount: {item.TotalAmount}\nDate: {item.Date}\nCount: {item.OrderItems.Count}");
            }
        }