예제 #1
0
        public async Task <IList <RateEntity> > GetRates()
        {
            var rates = await HttpClientHelpers.GetAsync <IList <RateEntity> >(appConfigSettings.RatesApiUrl)
                        .ConfigureAwait(false);

            return(rates);
        }
        public async Task <IList <TransactionEntity> > GetTransactions()
        {
            var transactions = await HttpClientHelpers.GetAsync <IList <TransactionEntity> >(appConfigSettings.TransactionApiUrl)
                               .ConfigureAwait(false);

            return(transactions);
        }
        public async Task <IList <CountryEntity> > GetCountriesByCurrency(string currency)
        {
            try
            {
                _logger.LogInformation($"GetCountriesByCurrency by {currency} was called");
                var restCountriesApi = _config["RestCountriesApi"];
                var url       = $"{restCountriesApi}{currency.ToLowerInvariant()}";
                var countries = await HttpClientHelpers.GetAsync <IList <CountryEntity> >(url)
                                .ConfigureAwait(false);

                return(countries);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed to get countries by {currency} : {ex}");
                throw;
            }
        }