Пример #1
0
        public ActionResult CustomerDetails(string userName)
        {
            var customer = _userService.Get(userName);
            var orders = _orderService.GetOrdersByCustomer(customer.Entity.Id);
            var model = new CustomerDetailsViewModel()
            {
                Orders = orders.Select(o => new OrderModel { Id = o.Id, DeliveryDate = o.DeliveryDate, IsReady = o.IsReady }).ToList(),
                Customer = customer.Entity
            };

            return View(model);
        }
Пример #2
0
        public ActionResult CustomerDetails(CustomerDetailsViewModel model)
        {
            if (model.Orders != null)
            {
                foreach (var item in model.Orders)
                {
                    var order = _orderService.GetOrder(item.Id);
                    order.IsReady = item.IsReady;
                    _orderService.UpdateOrder(order);
                }
            }

            return RedirectToAction("CustomerList");
        }
Пример #3
0
        public ActionResult OrderList()
        {
            var orders = _orderService.GetOrdersByCustomer(CurrentUser.Id);
            var model = new CustomerDetailsViewModel()
            {
                Orders = orders.Select(o => new OrderModel { Id = o.Id, DeliveryDate = o.DeliveryDate, IsReady = o.IsReady }).ToList(),
                Customer = CurrentUser
            };

            return View("~/Views/User/OrderList.cshtml", model);
        }