コード例 #1
0
        public async Task <Domain.Entities.TrainingProvider> GetProviderAsync(long ukprn)
        {
            Provider provider;

            try
            {
                provider = await _providerClient.GetAsync(ukprn);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Failed to retrieve provider information for UKPRN: {ukprn}");
                throw;
            }

            return(TrainingProviderMapper.MapFromApiProvider(provider));
        }
        public async Task <Domain.Entities.TrainingProvider> GetProviderAsync(long ukprn)
        {
            if (ukprn == EsfaTestTrainingProvider.Ukprn)
            {
                return(GetEsfaTestTrainingProvider());
            }

            try
            {
                var providers = await GetProviders();

                var provider = providers.Data.SingleOrDefault(c => c.Ukprn == ukprn);
                return(TrainingProviderMapper.MapFromApiProvider(provider));
            }
            catch (Exception ex)
            {
                _logger.LogWarning(ex, $"Failed to retrieve provider information for UKPRN: {ukprn}");
                return(null);
            }
        }