示例#1
0
        private void ViewOrderDetails(Order order)
        {
            List <Item> orderItems = _orderBL.GetOrderItems(order);
            //orderItems.ForEach(i => Console.WriteLine(i.ToString()));
            // for (int i = 1; i < orderItems.Count; i++)
            // {
            //     Console.WriteLine($"#{i} {orderItems[i]}");
            // }

            var currentColor = Console.ForegroundColor;
            var table        = new ConsoleTable("Name", "Price", "QTY", "$Amount");

            foreach (Item i in orderItems)
            {
                table.AddRow(i.Product.Name, i.Product.Price, i.Quantity, i.Quantity * i.Product.Price);
                Console.ForegroundColor = ConsoleColor.Blue;
            }
            table.Write();
            Console.ForegroundColor = currentColor;
        }
示例#2
0
 public List <OrderItem> GetOrderItems(int orderID)
 {
     return(_IOrderBL.GetOrderItems(orderID));
 }