示例#1
0
        public IActionResult Index(string apiKey, DateTime?from, DateTime?to, string fiatCurrency)
        {
            if (!from.HasValue && !to.HasValue)
            {
                from = new DateTime(DateTime.Now.Year - 1, 1, 1);
                to   = new DateTime(DateTime.Now.Year - 1, 12, 31);
            }

            TaxReportViewModel model = new TaxReportViewModel
            {
                AvailableCurrencies = _exchangeRateService.GetAvailableFiatCurrencies().OrderBy(c => c),
                SelectedCurrency    = GetFiatCurrency(fiatCurrency),
                From = from.Value,
                To   = to.Value
            };

            if (!string.IsNullOrEmpty(apiKey) && !string.IsNullOrEmpty(fiatCurrency))
            {
                try
                {
                    model.InterestsPerCoin = _transactionService.GetInterestsForSpecificTimeframe(apiKey, from.Value, to.Value, fiatCurrency);
                }
                catch (Exception ex)
                {
                    ViewBag.ExceptionOcurred = true;
                    return(View(model));
                }
            }

            return(View(model));
        }
示例#2
0
 public IEnumerable <string> GetAvailableCurrencies()
 {
     return(_exchangeRateService.GetAvailableFiatCurrencies());
 }