public void CreateStart(int userId)
        {
            var dbTransaction = new DBTransaction()
            {
                SenderUserId   = null,
                ReceiverUserId = userId,
                Amount         = 500,
                CreatedAt      = DateTime.Now
            };

            _transactionRepository.Create(dbTransaction);
        }
        private decimal GetBalanceAfterApplyTransaction(int userId, DBTransaction dbTransaction)
        {
            var positiveTransaction = _transactionRepository
                                      .Find(transaction => (transaction.CreatedAt < dbTransaction.CreatedAt ||
                                                            transaction.CreatedAt == dbTransaction.CreatedAt && transaction.Id <= dbTransaction.Id) &&
                                            transaction.ReceiverUserId == userId);
            var negativeTransaction = _transactionRepository
                                      .Find(transaction => (transaction.CreatedAt < dbTransaction.CreatedAt ||
                                                            transaction.CreatedAt == dbTransaction.CreatedAt && transaction.Id <= dbTransaction.Id) &&
                                            transaction.SenderUserId == userId);

            return(positiveTransaction.Sum(transaction => transaction.Amount) - negativeTransaction.Sum(transaction => transaction.Amount));
        }
 private Transaction Map(DBTransaction dbTransaction)
 {
     return(AutoMapperConfiguration.Mapper.Map(dbTransaction, new Transaction()));
 }