Ejemplo n.º 1
0
        public ActionResult Edit(int adminGid = -1)
        {
            if (adminGid < 3)
                return PromptView("内置管理员组不能修改");

            AdminGroupInfo adminGroupInfo = AdminGroups.GetAdminGroupById(adminGid);
            if (adminGroupInfo == null)
                return PromptView("管理员组不存在");

            AdminGroupModel model = new AdminGroupModel();
            model.AdminGroupTitle = adminGroupInfo.Title;
            model.ActionList = StringHelper.SplitString(adminGroupInfo.ActionList);

            Load();
            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult Add(AdminGroupModel model)
        {
            if (AdminGroups.GetAdminGroupIdByTitle(model.AdminGroupTitle) > 0)
                ModelState.AddModelError("AdminGroupTitle", "名称已经存在");

            if (ModelState.IsValid)
            {
                AdminGroupInfo adminGroupInfo = new AdminGroupInfo()
                {
                    Title = model.AdminGroupTitle,
                    ActionList = CommonHelper.StringArrayToString(model.ActionList).ToLower()
                };

                AdminGroups.CreateAdminGroup(adminGroupInfo);
                AddAdminOperateLog("添加管理员组", "添加管理员组,管理员组为:" + model.AdminGroupTitle);
                return PromptView("管理员组添加成功");
            }
            Load();
            return View(model);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public ActionResult Add()
 {
     AdminGroupModel model = new AdminGroupModel();
     Load();
     return View(model);
 }