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

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


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

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

            //数据持久化
            await _permissionRepository.ModifyAsync(modifyResult.Data);

            await _unitOfWork.CommitAsync(autoRollback : true);

            return(Result.ReSuccess());
        }
        public virtual async Task <Result> ModifySort(PermissionModifySortRequestDto dto)
        {
            //验证请求数据合法性
            var result = dto.Valid();

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


            //修改功能权限
            var modifyResult = await IocManager.Instance.Resolve <PermissionChangeService>().ModifySort(dto.Id, dto.Sort);

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

            //数据持久化
            await _permissionRepository.ModifyAsync(modifyResult.Data);

            return(Result.ReSuccess());
        }