private void ViewOrderByLocation() { Location location = SearchBranch(); string sortingCode = _validate.ValidateEmptyInput("Enter sorting code\n\t[0] - Sort by Order Cost ASC \n\t[1] - Sort by Order Cost DESC \n\t[2] - Sort by Order Date ASC \n\t[3] - Sort By Order Date DESC"); List <Order> orders = _orderBL.GetAllOrderByLocation(location, sortingCode); for (int i = 1; i < orders.Count; i++) { Console.WriteLine($"#{i} {orders[i]}"); } }
private void ViewOrderByLocation() { string sortingCode = _validate.ValidateEmptyInput("Enter sorting code\n\t[0] - Sort by Order Cost ASC \n\t[1] - Sort by Order Cost DESC \n\t[2] - Sort by Order Date ASC \n\t[3] - Sort By Order Date DESC"); List <Order> orders = _orderBL.GetAllOrderByLocation(branch, sortingCode); // for (int i = 1; i < orders.Count; i++) // { // Console.WriteLine($"#{i} {orders[i]}"); // } var table = new ConsoleTable("Order Id", "Order Date", "Total", "Customer Name"); var currentColor = Console.ForegroundColor; foreach (Order o in orders) { table.AddRow(o.Id, o.OrderDate, o.Total, o.Customer.FullName); Console.ForegroundColor = ConsoleColor.Blue; } table.Write(); Console.ForegroundColor = currentColor; }