Пример #1
0
        public async Task <SFA.DAS.Apprenticeships.Api.Types.Providers.Provider> GetProviderDetails(long ukPrn)
        {
            try
            {
                var result = await _providerApiClient.GetAsync(ukPrn);

                return(result);
            }
            catch (EntityNotFoundException ex)
            {
                _logger.Error(ex, $"Unable to get provider with ukprn: {ukPrn}");
                return(null);
            }
        }
        public async Task <string> GetProviderNameAsync(int ukprn)
        {
            try
            {
                var provider = await _retryPolicy.ExecuteAsync(context => _providerApiClient.GetAsync(ukprn), new Context(nameof(GetProviderNameAsync)));

                return(provider.ProviderName);
            }
            catch (EntityNotFoundException ex)
            {
                _logger.LogError(ex, $"Fat Api didn't find a provider for {ukprn}");

                return($"Unknown Provider ({ukprn})");
            }
        }
        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 <Feedback> GetProviderFeedbackAsync(long ukprn)
        {
            var result = await _providerApiClient.GetAsync(ukprn);

            return(result.ProviderFeedback);
        }