예제 #1
0
        public async Task <int> AddIdentityResourceAsync(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.AddIdentityResourceAsync(resource));
        }
예제 #2
0
        public virtual async Task <int> AddIdentityResourceAsync(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 saved = await IdentityResourceRepository.AddIdentityResourceAsync(resource);

            await AuditEventLogger.LogEventAsync(new IdentityResourceAddedEvent(identityResource));

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

            return(result > 0);
        }