// // GET: /Category/Edit/5 public ActionResult Edit(string id) { var vm = new EditCategoryViewModel (userService.GetUsers()) { Name = this.categoryService.GetCategory(id).Name, Type = this.categoryService.GetCategory(id).Type, AffectedUsersIds = this.categoryService.GetCategory(id).AffectedUsersIds }; return View(vm); }
public ActionResult Edit(string id, EditCategoryViewModel model) { if (ModelState.IsValid) { var command = new EditCategoryCommand { Name = model.Name, Type = model.Type, ID = id, AffectedUsersIds = model.AffectedUsersIds }; this.invoker.Execute(command); return RedirectToAction("Index"); } return View(model); }