// Summary: // Gets historic currency exchange rates to the base currency EUR for the date {dateval} // // Parameters: // DateTime dateval: // Any Historic DateTime value // Return: // HistoricExchangeRates // Typed response from the Http as HistoricExchangeRates public async Task <HistoricExchangeRates> GetConversionRatesByDate(DateTime dateval) { var historyDate = dateval.ToString("yyyy-MM-dd"); string apiUrl = $"/{historyDate}?base=EUR"; var responseMessage = await this._currencyApi.Call(apiUrl); HistoricExchangeRates historicExchangeRates = JsonConvert.DeserializeObject <HistoricExchangeRates>(responseMessage); return(historicExchangeRates); }
// Summary: // Get conversion rates for historic days. // // Parameters: // DateTime: // History datetime // Return: // ShowExchangeRateDto // An instance to ShowExchangeRateDto public async Task <ShowExchangeRateDto> GetHistoricRateByDate(DateTime dateval) { HistoricExchangeRates historicExchangeRates = await _currencyRepository.GetConversionRatesByDate(dateval); ShowExchangeRateDto showExchangeRateDto = new ShowExchangeRateDto() { Base = historicExchangeRates.Base, Timestamp = historicExchangeRates.Timestamp, Date = historicExchangeRates.Date, Rates = historicExchangeRates.Rates }; return(showExchangeRateDto); }