Ejemplo n.º 1
0
        public ActionResult Edit(UpdateOrderViewModel viewModel)
        {
            Order order = null;
            if (ModelState.IsValid)
            {
                order = orderRepo.GetSingleEntity(x => x.OrderId == viewModel.Order.OrderId);

                order.StatusId = viewModel.StatusId;
                order.Comment = viewModel.Order.Comment;

                orderRepo.Update(order);
                orderRepo.SaveChanges();

                return RedirectToAction("Index");
            }

            viewModel.Status = statusRepo.GetWithFilterAndOrder();
            viewModel.Order = order;

            return View(viewModel);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id = 0)
        {
            Order order = orderRepo.GetSingleEntity(x=> x.OrderId == id);
            if (order == null)
            {
                return HttpNotFound();
            }

            var viewModel = new UpdateOrderViewModel();

            viewModel.Status = statusRepo.GetWithFilterAndOrder();
            viewModel.Order = order;
            viewModel.StatusId = order.StatusId;

            return View(viewModel);
        }