示例#1
0
        public virtual async Task <int> DeleteApiScopePropertyAsync(ApiScopePropertiesDto apiScopeProperty)
        {
            var propertyEntity = apiScopeProperty.ToEntity();

            var deleted = await ApiScopeRepository.DeleteApiScopePropertyAsync(propertyEntity);

            await AuditEventLogger.LogEventAsync(new ApiScopePropertyDeletedEvent(apiScopeProperty));

            return(deleted);
        }
示例#2
0
        public virtual async Task <int> AddApiScopePropertyAsync(ApiScopePropertiesDto apiScopeProperties)
        {
            var canInsert = await CanInsertApiScopePropertyAsync(apiScopeProperties);

            if (!canInsert)
            {
                await BuildApiScopePropertiesViewModelAsync(apiScopeProperties);

                throw new UserFriendlyViewException(string.Format(ApiScopeServiceResources.ApiScopePropertyExistsValue().Description, apiScopeProperties.Key), ApiScopeServiceResources.ApiScopePropertyExistsKey().Description, apiScopeProperties);
            }

            var apiScopeProperty = apiScopeProperties.ToEntity();

            var saved = await ApiScopeRepository.AddApiScopePropertyAsync(apiScopeProperties.ApiScopeId, apiScopeProperty);

            await AuditEventLogger.LogEventAsync(new ApiScopePropertyAddedEvent(apiScopeProperties));

            return(saved);
        }
示例#3
0
        public virtual async Task <bool> CanInsertApiScopePropertyAsync(ApiScopePropertiesDto apiResourceProperty)
        {
            var resource = apiResourceProperty.ToEntity();

            return(await ApiScopeRepository.CanInsertApiScopePropertyAsync(resource));
        }