コード例 #1
0
        public IEnumerable <Transaction> GetTransactionsHistory(int activeUserId)
        {
            List <Transaction> mappedTransactions = new List <Transaction>();

            var transactionsFromCloud = TableReference.CreateQuery <CloudTransaction>().Where(t => t.UserId == activeUserId).ToList();

            foreach (var transaction in transactionsFromCloud)
            {
                mappedTransactions.Add(_mapper.Map <CloudTransaction, Transaction>(transaction));
            }

            return(mappedTransactions.OrderBy(d => d.TransactionDate));
        }
コード例 #2
0
        public double GetUserCryptocurrencyBalance(string currencyName, int userId)
        {
            var foundCurrencies = TableReference.CreateQuery <CloudTransaction>().Where(u => u.UserId == userId).Where(c => c.CurrencyName == currencyName).ToList();

            return(Math.Round(foundCurrencies.Sum(x => x.Amount), 7));
        }