public ActionResult Create(PermissionModel model, bool continueEditing) { if (ModelState.IsValid) { var permission = model.ToEntity(); _permissionService.InsertPermission(permission); SuccessNotification("添加成功"); return(continueEditing ? RedirectToAction("Edit", new { id = permission.Id }) : RedirectToAction("List")); } PrepareAllPermissionsModel(model); return(View(model)); }
public ActionResult Edit(PermissionModel model, bool continueEditing) { var permission = _permissionService.GetPermissionById(model.Id); if (ModelState.IsValid) { permission = model.ToEntity(permission); _permissionService.UpdatePermission(permission); SuccessNotification("保存成功"); return(continueEditing ? RedirectToAction("Edit", new { id = permission.Id }) : RedirectToAction("List")); } PrepareAllPermissionsModel(model); return(View(model)); }