示例#1
0
        public virtual async Task <IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate)
        {
            var identityResource = await IdentityResourceRepository.GetAsync(identityResourceUpdate.Id);

            identityResource.ConcurrencyStamp        = identityResourceUpdate.ConcurrencyStamp;
            identityResource.Name                    = identityResourceUpdate.Name ?? identityResource.Name;
            identityResource.DisplayName             = identityResourceUpdate.DisplayName ?? identityResource.DisplayName;
            identityResource.Description             = identityResourceUpdate.Description ?? identityResource.Description;
            identityResource.Enabled                 = identityResourceUpdate.Enabled;
            identityResource.Emphasize               = identityResourceUpdate.Emphasize;
            identityResource.ShowInDiscoveryDocument = identityResourceUpdate.ShowInDiscoveryDocument;
            if (identityResourceUpdate.UserClaims.Count > 0)
            {
                identityResource.RemoveAllUserClaims();
                foreach (var claim in identityResourceUpdate.UserClaims)
                {
                    identityResource.AddUserClaim(claim.Type);
                }
            }
            identityResource = await IdentityResourceRepository.UpdateAsync(identityResource);

            return(ObjectMapper.Map <IdentityResource, IdentityResourceDto>(identityResource));
        }
示例#2
0
 public virtual async Task <IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate)
 {
     return(await IdentityResourceAppService.UpdateAsync(identityResourceUpdate));
 }