Beispiel #1
0
        public async Task <IActionResult> OnGetAsync(int currencyToConvert)
        {
            //This takes lots of space and actually querries DB 3 times instead of 2
            //Maybe add claim?
            await FetchCustomerData();

            //Check if we have currency like this in the list of balances.
            if (CustomerBalances.Where(o => o.Currency == currencyToConvert).Count() > 0)
            {
                var convertedBalance = currencyConverter.ConvertListOfBalancesToGivenCurrency(CustomerBalances, (Currency)currencyToConvert);
                ConvertedBalance  = convertedBalance;
                ConvertedCurrency = currencyToConvert;
            }

            return(Page());
        }