public ActionResult AddPermission(PermissionEntity permission) { //var role = new RoleEntity() { RoleName = roleName }; //验证 if (ModelState.IsValid) { var result = RoleBLL.AddPermission(permission); if (result > 0) { return(RedirectToAction("PermissionList", "Role")); } ViewBag.ErrorMsg = "添加失败,请确认ID是否重复"; } // 如果我们进行到这一步时某个地方出错,则重新显示表单 return(View(permission)); }