Exemplo n.º 1
0
        public ActionResult EditRole(int?id, int?ParentID, string ParentName)
        {
            RoleInfo ri;

            if (id.HasValue)
            {
                ri = sysManageService.GetRoleInfo(id.Value);
                if (ri == null)
                {
                    throw new ArgumentException("参数错误,不存在对应的角色", "RoleID");
                }
                else
                {
                    if (ri.IsSystem)
                    {
                        throw new NoPermissionExecption("您无法编辑系统角色");
                    }
                }
            }
            else
            {
                ri = new RoleInfo();
                if (ParentID.HasValue)
                {
                    ri.ParentID   = ParentID;
                    ri.ParentName = ParentName;
                }
                else
                {
                    ri.ParentName = "根角色";
                }
            }
            return(View(ri));
        }