コード例 #1
0
 /// <summary>
 /// Should return exchange rates among the specified currencies that are defined by the source. But only those defined
 /// by the source, do not return calculated exchange rates. E.g. if the source contains "EUR/USD" but not "USD/EUR",
 /// do not return exchange rate "USD/EUR" with value calculated as 1 / "EUR/USD". If the source does not provide
 /// some of the currencies, ignore them.
 /// </summary>
 public IEnumerable <ExchangeRate> GetExchangeRates(IEnumerable <Currency> currencies)
 {
     return(provider.GetExchangeRates(currencies));
 }
コード例 #2
0
    public async Task <IActionResult> ExchangeRates(ExchangeRateSearchParameters exchangeRateSearchParameters)
    {
        var exchangeRates = await _exchangeRatesProvider.GetExchangeRates(exchangeRateSearchParameters);

        return(Ok(exchangeRates));
    }
コード例 #3
0
    public async Task <ExchangeRateDto?> GetExchangeRate(string currency)
    {
        var exchangeRates = await _exchangeRateProvider.GetExchangeRates(new ExchangeRateSearchParameters { Currencies = new [] { currency } });

        return(exchangeRates.FirstOrDefault() ?? await CreateOrUpdateExchangeRate(currency));
    }