public async Task <IdentityResourceDto> CreateAsync(CreateIdentityResourceInputDto input) { var nameExist = await _repository.CheckNameExistAsync(input.Name.Trim()); if (nameExist) { throw new IdentityResourceNameNotAllowedDuplicateException(input.Name); } var identityResource = new IdentityResource(GuidGenerator.Create(), input.Name.Trim()) { DisplayName = input.DisplayName?.Trim(), Description = input.Description?.Trim(), Enabled = input.Enabled, Required = input.Required, Emphasize = input.Emphasize, ShowInDiscoveryDocument = input.ShowInDiscoveryDocument }; input.UserClaims.ForEach(x => identityResource.AddUserClaim(x)); identityResource = await _repository.InsertAsync(identityResource); return(MapToGetOutputDto(identityResource)); }
public async Task <IdentityResourceDto> CreateAsync(CreateIdentityResourceInputDto input) { var nameExist = await _repository.CheckNameExistAsync(input.Name.Trim()); if (nameExist) { throw new IdentityResourceNameNotAllowedDuplicateException(input.Name); } var identityResource = new IdentityResource(GuidGenerator.Create(), input.Name.Trim()) { DisplayName = input.DisplayName?.Trim(), Description = input.Description?.Trim(), Enabled = input.Enabled, Required = input.Required, Emphasize = input.Emphasize, ShowInDiscoveryDocument = input.ShowInDiscoveryDocument, Properties = new Dictionary <string, string>() }; input.UserClaims.ForEach(x => identityResource.AddUserClaim(x)); if (input.Properties != null) { input.Properties.ForEach(x => { if (!identityResource.Properties.ContainsKey(x.Key)) { identityResource.Properties.Add(x.Key, x.Value); } }); } identityResource = await _repository.InsertAsync(identityResource); return(MapToGetOutputDto(identityResource)); }
public async Task <IdentityResourceDto> CreateAsync(CreateIdentityResourceInputDto input) { return(await this._identityResourceAppService.CreateAsync(input)); }