public ActionResult CreateOrder(OrderModel model)
        {
            var orderRepository = new OrderRepository();
            var order = new Order
            {
                OrderId = model.OrderId,
                OrderDateTime = model.OrderDateTime,
                CustomerId = model.CustomerId

            };
            orderRepository.CreateOrder(order);
            return RedirectToAction("AddItem", new {id = model.OrderId});
        }
 public ActionResult CreateOrder()
 {
     var repository = new CustomerRepository();
     var customerDictionary =
         repository.GetCustomers()
             .Select(c => new {CustomerId = c.CustomerId, CustomerName = c.FirstName + " " + c.LastName})
             .ToDictionary(x => x.CustomerId, x => x.CustomerName);
     var model = new OrderModel
     {
         OrderId = Guid.NewGuid(),
         OrderDateTime = DateTime.Now,
         CustomerDictionary = customerDictionary
     };
     return View(model);
 }
        public ActionResult ViewOrder(Guid id)
        {
            var repository = new OrderRepository();
            var order = repository.GetOrder(id);
            var model = new OrderModel
            {
                OrderId = order.OrderId,
                OrderCode = order.OrderCode,
                OrderDateTime = order.OrderDateTime,
                CustomerName = String.Format("{0} {1}", order.Customer.FirstName, order.Customer.LastName),
                OrderTotal = order.OrderTotal
            };
            model.OrderItems = order.OrderItems.Select(oi => new OrderItemModel
            {
                OrderItemId = oi.OrderItemId,
                OrderId = oi.OrderId,
                ProductName = oi.Product.ProductName,
                Quantity = oi.Quantity,
                OrderItemTotal = oi.OrderItemTotal.ToString("c")
            }).ToList();

            return View(model);
        }