public virtual async Task <int> DeleteApiScopeAsync(ApiScopesDto apiScope) { var scope = apiScope.ToEntity(); var deleted = await ApiResourceRepository.DeleteApiScopeAsync(scope); await AuditEventLogger.LogEventAsync(new ApiScopeDeletedEvent(apiScope)); return(deleted); }
public async Task <int> UpdateApiScopeAsync(ApiScopesDto apiScope) { var canInsert = await CanInsertApiScopeAsync(apiScope); if (!canInsert) { await BuildApiScopesViewModel(apiScope); throw new UserFriendlyViewException(string.Format(_apiResourceServiceResources.ApiScopeExistsValue().Description, apiScope.Name), _apiResourceServiceResources.ApiScopeExistsKey().Description, apiScope); } var scope = apiScope.ToEntity(); return(await _apiResourceRepository.UpdateApiScopeAsync(apiScope.ApiResourceId, scope)); }
public virtual async Task <int> AddApiScopeAsync(ApiScopesDto apiScope) { var canInsert = await CanInsertApiScopeAsync(apiScope); if (!canInsert) { await BuildApiScopesViewModelAsync(apiScope); throw new UserFriendlyViewException(string.Format(ApiResourceServiceResources.ApiScopeExistsValue().Description, apiScope.Name), ApiResourceServiceResources.ApiScopeExistsKey().Description, apiScope); } var scope = apiScope.ToEntity(); var added = await ApiResourceRepository.AddApiScopeAsync(apiScope.ApiResourceId, scope); await AuditEventLogger.LogEventAsync(new ApiScopeAddedEvent(apiScope)); return(added); }
public async Task <bool> CanInsertApiScopeAsync(ApiScopesDto apiScopes) { var apiScope = apiScopes.ToEntity(); return(await _apiResourceRepository.CanInsertApiScopeAsync(apiScope)); }
public async Task <int> DeleteApiScopeAsync(ApiScopesDto apiScope) { var scope = apiScope.ToEntity(); return(await _apiResourceRepository.DeleteApiScopeAsync(scope)); }