Пример #1
0
        public static void AddOrder(ref RestaurantManager restaurantManager)
        {
            Console.WriteLine("Enter Menu Number");
            string orderNo = Console.ReadLine();

            while (string.IsNullOrWhiteSpace(orderNo))
            {
                Console.WriteLine("Error! Enter the order number correctly!");
                orderNo = Console.ReadLine();
            }
            Console.WriteLine("Enter the count:");
            string countStr = Console.ReadLine();
            int    count;

            while (!int.TryParse(countStr, out count) || count < 1)
            {
                Console.WriteLine("Error! Enter the count correctly!");
                countStr = Console.ReadLine();
            }

            try
            {
                restaurantManager.AddOrder(orderNo, count);
                Console.WriteLine("Order added successfully!");
            }
            catch (OrderNotFoundException ex)
            {
                Console.WriteLine("Error: " + ex.Message);
            }
        }