public async Task <IActionResult> GetRatesForCurrencies() { string exchangeRatesData; try { exchangeRatesData = await _exchange.GetExchangeRatesData(_apiConnections.UriString, _apiConnections.RequestUriAllRates); } catch (StatusCodeException e) { var codeNumber = e.CodeNumber; return(StatusCode(codeNumber, StatusCodeResponses.GetResponseMessage(codeNumber))); } var exchangeRates = _exchange.GetExchangeRates(exchangeRatesData); const string message = "Current exchange rates (currency to PLN):\n"; var actualRates = _exchangeHelper.GetActualRates(exchangeRates); var codes = JsonConvert.SerializeObject(actualRates); return(Ok(message + codes)); }
public Dictionary <string, int> LoadCodeCurrencies(IExchange exchange, string uriString, string requestUriAllRates) { var exchangeData = exchange.GetExchangeRatesData(uriString, requestUriAllRates).Result; return(exchange.GetCodesForExchangeRates(exchangeData)); }