示例#1
0
        public async Task <IEnumerable <TransactionViewModel> > GetAllTransactions(TransactionViewModel viewModel)
        {
            try
            {
                newCurrency = viewModel.Currency;

                transactions = (await transactionService.TryGetTransactions(x => x.Sku == viewModel.Sku)).Select(x => new TransactionViewModel(x));
                transactions = SetCurrencyConvertedToTransactions();

                IList <TransactionViewModel> result = new List <TransactionViewModel>();

                TransactionViewModel[] tasks = await Task.WhenAll(transactions.Take(100).Select(transaction => currencyConverter.ApplyConversion(transaction)));

                var data = tasks.Where(x => x != null).ToList();
                return(data);
            }
            catch (Exception e)
            {
                throw e;
            }
        }