public async Task <double> GetAUDToUSDRate() { var model = await _currencyRateService.GetCurrencyRates("AUD"); if (model.IsSuccessful) { return(model.Rates.USD); } else { return(-1); } }
public async Task <ActionResult> OnPostAsync(DateTime datePicker, string currency) { DateSelected = datePicker.ToString("yyyy-MM-dd"); CurrencySelected = currency; try { List <CurrencyRate> currencyRatesData = await _currencyRateService.GetCurrencyRates(datePicker.Date, currency, _currencyDefault); CurrencyRatesConverted = ConvertRatesToFrontEnd(currencyRatesData, currency, _currencyDefault); } catch (Exception ex) { _logRepository.AddException(ex.Message); ErrorRequestUser = "******" + DateSelected + " не был обработан. Произошла ошибка!"; } return(Page()); }