Ejemplo n.º 1
0
        public async Task <int> UpdateIdentityResourceAsync(IdentityResourceDto identityResource)
        {
            var canInsert = await CanInsertIdentityResourceAsync(identityResource);

            if (!canInsert)
            {
                throw new UserFriendlyViewException(string.Format(_identityResourceServiceResources.IdentityResourceExistsValue().Description, identityResource.Name), _identityResourceServiceResources.IdentityResourceExistsKey().Description, identityResource);
            }

            var resource = identityResource.ToEntity();

            return(await _identityResourceRepository.UpdateIdentityResourceAsync(resource));
        }
Ejemplo n.º 2
0
        public virtual async Task <int> UpdateIdentityResourceAsync(IdentityResourceDto identityResource)
        {
            var canInsert = await CanInsertIdentityResourceAsync(identityResource);

            if (!canInsert)
            {
                throw new UserFriendlyViewException(string.Format(IdentityResourceServiceResources.IdentityResourceExistsValue().Description, identityResource.Name), IdentityResourceServiceResources.IdentityResourceExistsKey().Description, identityResource);
            }

            var resource = identityResource.ToEntity();

            var originalIdentityResource = await GetIdentityResourceAsync(resource.Id);

            var updated = await IdentityResourceRepository.UpdateIdentityResourceAsync(resource);

            await AuditEventLogger.LogEventAsync(new IdentityResourceUpdatedEvent(originalIdentityResource, identityResource));

            return(updated);
        }
        public async Task <bool> UpdateIdentityResourceAsync(IdentityResource identityResource)
        {
            var result = await _repo.UpdateIdentityResourceAsync(identityResource);

            return(result > 0);
        }