Exemplo n.º 1
0
        public ActionResult Update(int id, UpdateOrderViewModel model)
        {
            var entity = model.ToEntity(id);
            var result = _service.Update(entity);

            if (result.Success)
            {
                return RedirectToAction("details", new { id = result.Entity.Id });
            }

            ModelState.AddModelErrorsFromServiceResult(result);

            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult Update(int id)
        {
            var order = _service.Query().GetById(id);

            if (order == null)
            {
                throw new HttpException(404, "Not Found");
            }

            var viewModel = new UpdateOrderViewModel(order);

            return View(viewModel);
        }