Exemplo n.º 1
0
        public async Task <IEnumerable <Wallet> > GetAllWalletsAsync()
        {
            var userId  = _userIdProvider.GetUserId();
            var wallets = await _repository.GetAllWalletsByUserIdAsync(userId);

            return(_mapper.Map <IEnumerable <Wallet> >(wallets.OrderBy(w => w.Name)).ToArray());
        }
        public async Task <WalletsViewModel> GetAllWalletsAsync()
        {
            var userId  = _userIdProvider.GetUserId();
            var wallets = await _repository.GetAllWalletsByUserIdAsync(userId);

            return(_mapper.Map <WalletsViewModel>(wallets));
        }
Exemplo n.º 3
0
        public async Task <TransactionViewModel> GetTransactionAsync(long?transactionId = null)
        {
            var userId  = _userIdProvider.GetUserId();
            var wallets = await _walletsRepository.GetAllWalletsByUserIdAsync(userId);

            var viewModel = new TransactionViewModel();

            if (transactionId.HasValue)
            {
                var transaction = await _transactionsRepository
                                  .GetTransactionByIdAsync(transactionId.Value);

                viewModel         = _mapper.Map <TransactionViewModel>(transaction);
                viewModel.Wallets = new SelectList(wallets, "Id", "Name", viewModel.SelectedWalletId);
            }
            else
            {
                viewModel.Wallets = new SelectList(wallets, "Id", "Name");
            }

            return(viewModel);
        }