Пример #1
0
        /// <summary>
        /// Handles displaying the details of an order - the location, the customer, and each of its
        /// line items.
        /// </summary>
        private static void HandleRequestDisplayDetailsOfOrder()
        {
            Console.WriteLine("[?] What is the order ID");
            string inputOrderId = Console.ReadLine();

            Log.Information($"User entered '{inputOrderId}' for order id");
            if (!Int32.TryParse(inputOrderId, out int orderId))
            {
                throw new FormatException("[!] Input for order ID is not an integer");
            }

            BusinessOrder order = OrderData.GetOrderWithId(orderId);

            if (order is null)
            {
                throw new BusinessOrderException($"[!] Order {orderId} does not exist in the database");
            }

            Console.WriteLine($"{order}\n");
        }