public async Task <IActionResult> Get() { var rates = await _ratesService.GetRatesAsync(); if (rates == null) { return(NotFound()); } return(Ok(rates)); }
public async Task <List <TransactionData> > GetTransactionsAsync() { //obtain data from API List <RootObject> sortedListByDate = await _ratesService.GetRatesAsync(); //obtain data from .CSV files List <TransactionData> values = _transactionsService.GetTransactions(); //merge API + .csv files List <TransactionData> mergedResults = _transactionsService.PopulateEurField(values, sortedListByDate); return(mergedResults); }
public async Task <ConvertedCurrencyResponse> GetConvertedCurrencyAsync(CurrencyRequest request) { if (request == null) { throw new HttpRequestException(); } var rates = await _ratesService.GetRatesAsync(request.SourceCurrency); rates.Rates.TryGetValue(request.TargetCurrency, out var value); var convertedValue = ConvertAmount(value, request.Amount); return(new ConvertedCurrencyResponse() { TargetCurrency = request.TargetCurrency, ConvertedAmount = convertedValue, }); }
public async Task <IQueryable <DtoRate> > Get() { return(await _ratesService.GetRatesAsync()); }