Example #1
0
        public virtual async Task <IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate)
        {
            var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyCreate.IdentityResourceId);

            if (identityResource.Properties.ContainsKey(identityResourcePropertyCreate.Key))
            {
                throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyExisted, identityResourcePropertyCreate.Key]);
            }
            identityResource.ConcurrencyStamp = identityResourcePropertyCreate.ConcurrencyStamp;
            identityResource.Properties.Add(identityResourcePropertyCreate.Key, identityResourcePropertyCreate.Value);

            await IdentityResourceRepository.UpdateAsync(identityResource);

            return(new IdentityResourcePropertyDto
            {
                Key = identityResourcePropertyCreate.Key,
                Value = identityResourcePropertyCreate.Value
            });
        }
Example #2
0
 public virtual async Task <IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate)
 {
     return(await IdentityResourceAppService.AddPropertyAsync(identityResourcePropertyCreate));
 }