Ejemplo n.º 1
0
        /// <summary>
        /// 异步更新Api资源
        /// </summary>
        /// <param name="dto">要传入DTO</param>
        /// <returns></returns>

        public async Task <OperationResponse> UpdateApiResourceAsync(ApiResourceInputDto dto)
        {
            dto.NotNull(nameof(dto));
            return(await _apiResourceRepository.UpdateAsync(dto, async (entity, dto1) =>
            {
                MessageBox.ShowIf($"指定【{dto.Name}】Api资源已存在", await this.CheckApiResourceIsExist(dto1.Id, dto1.Name));
            }));
        }
        /// <summary>
        /// 异步创建Api资源
        /// </summary>
        /// <param name="dto">要传入DTO</param>
        /// <returns></returns>

        public async Task <OperationResponse> CreateApiResourceAsync(ApiResourceInputDto dto)
        {
            dto.NotNull(nameof(dto));
            return(await _apiResourceRepository.InsertAsync(dto, async (dto) =>
            {
                MessageBox.ShowIf("Api资源已存在", await this.CheckApiResourceIsExist(dto.Id, dto.Name));
            }));
        }
Ejemplo n.º 3
0
        public async Task <OperationResponse> CreateAsync(ApiResourceInputDto input)
        {
            input.NotNull(nameof(input));
            var apiresourceentity = new ApiResource(input.Name, input.DisplayName);

            //var apiresourceentity = new ApiResource();
            apiresourceentity.AddUserClaims(input.UserClaims);
            return(await _apiResourceDomainService.CreateApiResourceAsync(apiresourceentity));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 异步创建Api资源
        /// </summary>
        /// <param name="dto">要传入DTO</param>
        /// <returns></returns>

        public async Task <OperationResponse> CreateApiResourceAsync(ApiResourceInputDto dto)
        {
            dto.NotNull(nameof(dto));
            //dto.ApiSecrets = new List<ApiResourceSecretDto>();
            //dto.ApiSecrets.Add(new ApiResourceSecretDto(dto.ApiSecretValue));
            return(await _apiResourceRepository.InsertAsync(dto, async (dto1) =>
            {
                MessageBox.ShowIf($"指定【{dto.Name}】Api资源已存在", await this.CheckApiResourceIsExist(dto1.Id, dto1.Name));
            }));
        }