public ActionResult Create(RoleModel model, bool continueEditing) { if (ModelState.IsValid) { var role = model.ToEntity(); _roleService.InsertRole(role); SuccessNotification("添加成功"); return continueEditing ? RedirectToAction("Edit", new { id = role.Id }) : RedirectToAction("List"); } return View(model); }
public ActionResult Create() { var model = new RoleModel(); return View(model); }
public ActionResult Edit(RoleModel model, bool continueEditing) { var role = _roleService.GetRoleById(model.Id); if (ModelState.IsValid) { role = model.ToEntity(role); _roleService.UpdateRole(role); SuccessNotification("更新成功"); return continueEditing ? RedirectToAction("Edit", new { id = role.Id }) : RedirectToAction("List"); } return View(model); }