Esempio n. 1
0
        public ResponseViewModel OperRoleGroup(TreePostData postData)
        {
            ResponseViewModel vm = new ResponseViewModel();

            if (postData.Operation == TreeNodeOper.DELETE_NODE)
            {
                vm.success = _rbacService.DeleteUserGroup(postData.Id);
            }
            else if (postData.Operation == TreeNodeOper.CREATE_NODE)
            {
                FapRoleGroup roleGroup = new FapRoleGroup()
                {
                    Pid           = postData.Id,
                    RoleGroupName = postData.Text
                };
                _rbacService.CreateRoleGroup(roleGroup);
                vm.success = true;
                vm.data    = roleGroup.Fid;
            }
            else if (postData.Operation == TreeNodeOper.RENAME_NODE)
            {
                var roleGroup = _dbContext.Get <FapRoleGroup>(postData.Id);
                roleGroup.RoleGroupName = postData.Text;
                vm.success = _rbacService.EditRoleGroup(roleGroup);
            }
            else if (postData.Operation == "move_node")
            {
                var roleGroup = _dbContext.Get <FapRoleGroup>(postData.Id);
                roleGroup.Pid = postData.Parent;
                vm.success    = _rbacService.EditRoleGroup(roleGroup);
            }
            else if (postData.Operation == TreeNodeOper.COPY_NODE)
            {
                throw new NotImplementedException();
            }
            return(vm);
        }
Esempio n. 2
0
 public long CreateRoleGroup(FapRoleGroup roleGroup)
 {
     return(_dbContext.Insert(roleGroup));
 }
Esempio n. 3
0
 public bool EditRoleGroup(FapRoleGroup roleGroup)
 {
     return(_dbContext.Update(roleGroup));
 }