Exemplo n.º 1
0
        public ResponseViewModel OperBusinessRole(TreePostData postData)
        {
            ResponseViewModel vm = new ResponseViewModel();

            if (postData.Operation == TreeNodeOper.DELETE_NODE)
            {
                vm.success = _rbacService.DeleteBizRole(postData.Id);
            }
            else if (postData.Operation == TreeNodeOper.CREATE_NODE)
            {
                FapBizRole bizRole = new FapBizRole()
                {
                    Pid         = postData.Id,
                    BizRoleName = postData.Text
                };
                _rbacService.CreateBizRole(bizRole);
                vm.success = true;
                vm.data    = bizRole.Fid;
            }
            else if (postData.Operation == TreeNodeOper.RENAME_NODE)
            {
                var bizRole = _dbContext.Get <FapBizRole>(postData.Id);
                bizRole.BizRoleName = postData.Text;
                vm.success          = _rbacService.EditBizRole(bizRole);
            }
            else if (postData.Operation == "move_node")
            {
                var bizRole = _dbContext.Get <FapBizRole>(postData.Id);
                bizRole.Pid = postData.Parent;
                vm.success  = _rbacService.EditBizRole(bizRole);
            }
            else if (postData.Operation == TreeNodeOper.COPY_NODE)
            {
                throw new NotImplementedException();
            }
            return(vm);
        }