public async Task <IActionResult> GetQuotes(string sourceCurrency, string destinationCurrency) { var destionationCurrencyList = new List <string>() { destinationCurrency }; try { QuoteCurrencyResult result = await quoteCurrencyService.GetQuote(sourceCurrency, destionationCurrencyList); return(Ok(result)); } catch (Exception exception) { return(StatusCode(500, exception)); } }
private QuoteCurrencyResult ParseCurrencyLayerResult(CurrencyLayerResult currencyLayerResult) { var result = new QuoteCurrencyResult() { Quotes = new List <Quote>() }; result.Source = currencyLayerResult.Source; foreach (KeyValuePair <string, double> quote in currencyLayerResult.Quotes) { var currencyName = quote.Key; currencyName = currencyName.Replace(result.Source, ""); result.Quotes.Add(new Quote() { CurrencyName = currencyName, CurrencyValue = quote.Value }); } return(result); }