コード例 #1
0
        private async Task BuildIdentityResourcePropertiesViewModelAsync(IdentityResourcePropertiesDto identityResourceProperties)
        {
            var propertiesDto = await GetIdentityResourcePropertiesAsync(identityResourceProperties.IdentityResourceId);

            identityResourceProperties.IdentityResourceProperties.AddRange(propertiesDto.IdentityResourceProperties);
            identityResourceProperties.TotalCount = propertiesDto.TotalCount;
        }
コード例 #2
0
        public async Task <IActionResult> IdentityResourcePropertyDelete(IdentityResourcePropertiesDto identityResourceProperty)
        {
            await _identityResourceService.DeleteIdentityResourcePropertyAsync(identityResourceProperty);


            return(Success(new { Id = identityResourceProperty.IdentityResourceId }));
        }
コード例 #3
0
        public async Task <IActionResult> IdentityResourcePropertyDelete(IdentityResourcePropertiesDto identityResourceProperty)
        {
            await _identityResourceService.DeleteIdentityResourcePropertyAsync(identityResourceProperty);

            SuccessNotification(_localizer["SuccessDeleteIdentityResourceProperty"], _localizer["SuccessTitle"]);

            return(RedirectToAction(nameof(IdentityResourceProperties), new { Id = identityResourceProperty.IdentityResourceId }));
        }
コード例 #4
0
        public virtual async Task <int> DeleteIdentityResourcePropertyAsync(IdentityResourcePropertiesDto identityResourceProperty)
        {
            var propertyEntity = identityResourceProperty.ToEntity();

            var deleted = await IdentityResourceRepository.DeleteIdentityResourcePropertyAsync(propertyEntity);

            await AuditEventLogger.LogEventAsync(new IdentityResourcePropertyDeletedEvent(identityResourceProperty));

            return(deleted);
        }
コード例 #5
0
        public async Task <IActionResult> DeleteProperty(int propertyId)
        {
            var identityResourceProperty = new IdentityResourcePropertiesDto {
                IdentityResourcePropertyId = propertyId
            };

            await _identityResourceService.GetIdentityResourcePropertyAsync(identityResourceProperty.IdentityResourcePropertyId);

            await _identityResourceService.DeleteIdentityResourcePropertyAsync(identityResourceProperty);

            return(Ok());
        }
コード例 #6
0
        public async Task <IActionResult> IdentityResourceProperties(IdentityResourcePropertiesDto identityResourceProperty)
        {
            if (!ModelState.IsValid)
            {
                return(Success(identityResourceProperty));
            }

            await _identityResourceService.AddIdentityResourcePropertyAsync(identityResourceProperty);


            return(Success(new { Id = identityResourceProperty.IdentityResourceId }));
        }
コード例 #7
0
        public async Task <IActionResult> IdentityResourceProperties(IdentityResourcePropertiesDto identityResourceProperty)
        {
            if (!ModelState.IsValid)
            {
                return(View(identityResourceProperty));
            }

            await _identityResourceService.AddIdentityResourcePropertyAsync(identityResourceProperty);

            SuccessNotification(string.Format(_localizer["SuccessAddIdentityResourceProperty"], identityResourceProperty.Value, identityResourceProperty.IdentityResourceName), _localizer["SuccessTitle"]);

            return(RedirectToAction(nameof(IdentityResourceProperties), new { Id = identityResourceProperty.IdentityResourceId }));
        }
コード例 #8
0
        public virtual async Task <int> AddIdentityResourcePropertyAsync(IdentityResourcePropertiesDto identityResourceProperties)
        {
            var canInsert = await CanInsertIdentityResourcePropertyAsync(identityResourceProperties);

            if (!canInsert)
            {
                await BuildIdentityResourcePropertiesViewModelAsync(identityResourceProperties);

                throw new UserFriendlyViewException(string.Format(IdentityResourceServiceResources.IdentityResourcePropertyExistsValue().Description, identityResourceProperties.Key), IdentityResourceServiceResources.IdentityResourcePropertyExistsKey().Description, identityResourceProperties);
            }

            var identityResourceProperty = identityResourceProperties.ToEntity();

            return(await IdentityResourceRepository.AddIdentityResourcePropertyAsync(identityResourceProperties.IdentityResourceId, identityResourceProperty));
        }
コード例 #9
0
 public IdentityResourcePropertyDeletedEvent(IdentityResourcePropertiesDto identityResourceProperty)
 {
     IdentityResourceProperty = identityResourceProperty;
 }
コード例 #10
0
 //-----------------------------------IdentityResourceProperties---------------------------------------------------
 public static IdentityResourceProperty ToEntity(this IdentityResourcePropertiesDto identityResourceProperties)
 {
     return(Mapper.Map <IdentityResourceProperty>(identityResourceProperties));
 }
 public IdentityResourcePropertyRequestedEvent(IdentityResourcePropertiesDto identityResourceProperties)
 {
     IdentityResourceProperties = identityResourceProperties;
 }
コード例 #12
0
        public virtual async Task <int> DeleteIdentityResourcePropertyAsync(IdentityResourcePropertiesDto identityResourceProperty)
        {
            var propertyEntity = identityResourceProperty.ToEntity();

            return(await IdentityResourceRepository.DeleteIdentityResourcePropertyAsync(propertyEntity));
        }
コード例 #13
0
        public virtual async Task <bool> CanInsertIdentityResourcePropertyAsync(IdentityResourcePropertiesDto identityResourcePropertiesDto)
        {
            var resource = identityResourcePropertiesDto.ToEntity();

            return(await IdentityResourceRepository.CanInsertIdentityResourcePropertyAsync(resource));
        }