Example #1
0
        public async Task <Result> ModifyMenu([FromBody] PermissionMenuModifyRequestDto dto)
        {
            //验证请求数据合法性
            var result = dto.Valid();

            if (!result.Success)
            {
                return(result);
            }

            //修改功能权限
            var modifyResult = await this._serviceProvider.GetRequiredService <PermissionChangeService>().ModifyMenu(dto.Id, dto.Name, dto.ParentId, dto.Description, dto.Enable, dto.Sort);

            if (!modifyResult.Success)
            {
                return(modifyResult);
            }

            //数据持久化
            _operateLog.Record(ASFPermissions.PermissionModifyMenu, dto, "Success");  //记录日志
            await _permissionRepository.ModifyAsync(modifyResult.Data);

            await _unitOfWork.CommitAsync(autoRollback : true);

            return(Result.ReSuccess());
        }
Example #2
0
        public virtual async Task <Result> Modify(PermissionMenuModifyRequestDto dto)
        {
            //验证请求数据合法性
            var result = dto.Valid();

            if (!result.Success)
            {
                return(result);
            }

            //修改功能权限
            var modifyResult = await IocManager.Instance.Resolve <PermissionChangeService>()
                               .ModifyMenu(dto.Id, dto.Name, dto.ParentId, dto.Description, dto.Enable, dto.Icon, dto.Redirect, dto.Hidden);

            if (!modifyResult.Success)
            {
                return(modifyResult);
            }

            //数据持久化
            _operateLog.Record(ASFPermissions.PermissionModifyMenu, dto, "Success");  //记录日志
            await _permissionRepository.ModifyAsync(modifyResult.Data);

            return(Result.ReSuccess());
        }