/// <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 "CZK/USD" but not "USD/CZK", /// do not return exchange rate "USD/CZK" with value calculated as 1 / "CZK/USD". If the source does not provide /// some of the currencies, ignore them. /// </summary> public IEnumerable <ExchangeRate> GetExchangeRates(IEnumerable <Currency> currencies) { if (currencies == null) { throw new ArgumentNullException(nameof(currencies)); } if (currencies.Count() == 0) { return(Enumerable.Empty <ExchangeRate>()); } using (Stream content = _client.GetDataAsync().Result) using (var reader = new StreamReader(content)) { IDictionary <string, decimal> rates = _rateExtractor.Extract(reader.ReadToEnd()); return(Compose(currencies, rates)); } }
public async Task <IActionResult> GetRest() { var result = await _restClient.GetDataAsync(new DataRequest()); return(Ok(result)); }