コード例 #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));
            }));
        }
コード例 #2
0
 public Task <OperationResponse> CreateOrUpdateApiResourceAsync(ApiResourceInputDto dto)
 {
     if (dto.Id == Guid.Empty)
     {
         return(this.CreateApiResourceAsync(dto));
     }
     return(this.UpdateApiResourceAsync(dto));
 }
コード例 #3
0
        /// <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));
            }));
        }
コード例 #4
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));
        }
コード例 #5
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));
            }));
        }
コード例 #6
0
 public async Task <AjaxResult> CreateAsync([FromBody] ApiResourceInputDto input)
 {
     return((await _apiResourceContract.CreateAsync(input)).ToAjaxResult());
 }
コード例 #7
0
 public async Task <AjaxResult> CreateApiResourceAsync([FromBody] ApiResourceInputDto dto)
 {
     return((await _apiResourceService.CreateApiResourceAsync(dto)).ToAjaxResult());
 }