예제 #1
0
        public ActionResult Edit(AdminGroupModel model, int adminGid = -1)
        {
            if (adminGid < 3)
            {
                return(PromptView("内置管理员组不能修改"));
            }

            AdminGroupInfo adminGroupInfo = AdminGroups.GetAdminGroupById(adminGid);

            if (adminGroupInfo == null)
            {
                return(PromptView("管理员组不存在"));
            }

            int adminGid2 = AdminGroups.GetAdminGroupIdByTitle(model.AdminGroupTitle);

            if (adminGid2 > 0 && adminGid2 != adminGid)
            {
                ModelState.AddModelError("AdminGroupTitle", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                adminGroupInfo.Title      = model.AdminGroupTitle;
                adminGroupInfo.ActionList = CommonHelper.StringArrayToString(model.ActionList).ToLower();
                AdminGroups.UpdateAdminGroup(adminGroupInfo);
                AddAdminOperateLog("修改管理员组", "修改管理员组,管理员组ID为:" + adminGid);
                return(PromptView("管理员组修改成功"));
            }

            Load();
            return(View(model));
        }