public virtual async Task <ApiScopesDto> GetApiScopeAsync(int apiScopeId) { var apiScope = await ApiResourceRepository.GetApiScopeAsync(apiScopeId); if (apiScope == null) { throw new UserFriendlyErrorPageException(string.Format(ApiResourceServiceResources.ApiScopeDoesNotExist().Description, apiScopeId), ApiResourceServiceResources.ApiScopeDoesNotExist().Description); } var apiScopesDto = apiScope.ToModel(); await AuditEventLogger.LogEventAsync(new ApiScopeRequestedEvent(apiScopesDto)); return(apiScopesDto); }
public async Task <ApiScopesDto> GetApiScopeAsync(int apiResourceId, int apiScopeId) { var apiResource = await _apiResourceRepository.GetApiResourceAsync(apiResourceId); if (apiResource == null) { throw new UserFriendlyErrorPageException(string.Format(_apiResourceServiceResources.ApiResourceDoesNotExist().Description, apiResourceId), _apiResourceServiceResources.ApiResourceDoesNotExist().Description); } var apiScope = await _apiResourceRepository.GetApiScopeAsync(apiResourceId, apiScopeId); if (apiScope == null) { throw new UserFriendlyErrorPageException(string.Format(_apiResourceServiceResources.ApiScopeDoesNotExist().Description, apiScopeId), _apiResourceServiceResources.ApiScopeDoesNotExist().Description); } var apiScopesDto = apiScope.ToModel(); apiScopesDto.ResourceName = await GetApiResourceNameAsync(apiResourceId); return(apiScopesDto); }