//// ReSharper restore NotAccessedField.Local public static void Main(string[] args) { _eventAggregator = new SimpleEventAggregator(); _orderListView = new OrdersListView(); _orderDetailView = new OrderDetailView(_eventAggregator); _orderHistoryView = new OrderHistoryView(_eventAggregator); _orderView = new OrderView(_eventAggregator); var orders = GenerateOrders(); _orderListView.EventAggregator = _eventAggregator; _orderListView.SetOrders(orders); ConsoleKeyInfo consoleKeyInfo; do { Console.Write("Enter an order number: "); consoleKeyInfo = Console.ReadKey(); Console.WriteLine(); int? number = ParseCharacter(consoleKeyInfo); if (number.HasValue) { _orderListView.SelectOrder(number.Value); Thread.Sleep(500); } else { Console.WriteLine("Invalid input"); } } while (consoleKeyInfo.Key != ConsoleKey.Enter); }
//// ReSharper restore NotAccessedField.Local public static void Main(string[] args) { _eventAggregator = new SimpleEventAggregator(); _orderListView = new OrdersListView(); _orderDetailView = new OrderDetailView(_eventAggregator); _orderHistoryView = new OrderHistoryView(_eventAggregator); _orderView = new OrderView(_eventAggregator); var orders = GenerateOrders(); _orderListView.EventAggregator = _eventAggregator; _orderListView.SetOrders(orders); ConsoleKeyInfo consoleKeyInfo; do { Console.Write("Enter an order number: "); consoleKeyInfo = Console.ReadKey(); Console.WriteLine(); int?number = ParseCharacter(consoleKeyInfo); if (number.HasValue) { _orderListView.SelectOrder(number.Value); Thread.Sleep(500); } else { Console.WriteLine("Invalid input"); } }while (consoleKeyInfo.Key != ConsoleKey.Enter); }
public ActionResult Orders() { // Fetch all orders per user var orders = _orderService.GetOrdersForUser(User.Identity.Name).OrderByDescending(o => o.OrderId); // Map to view model var viewModel = new OrderHistoryView { Orders = orders.Select(Mapper.Map<Orders.Order, OrderView>).ToArray() }; return View(viewModel); }