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); }
public bool EditBizRole(FapBizRole bizRole) { return(_dbContext.Update(bizRole)); }
public long CreateBizRole(FapBizRole bizRole) { return(_dbContext.Insert(bizRole)); }