Beispiel #1
0
        private void OnFundsDeposited(FundsDepositedEvent @event)
        {
            CurrentBalance = CurrentBalance + @event.Amount;
            var newTransaction = new Transaction(TransactionType.Deposit, @event.AggregateId, @event.Amount);

            Transactions.Add(newTransaction);
        }
        public void Apply(FundsDepositedEvent @event)
        {
            var newTransaction = new Transaction {
                Id = @event.Id, Amount = @event.Amount
            };

            Transactions.Add(newTransaction);
            CurrentBalance = CurrentBalance + @event.Amount;
        }
Beispiel #3
0
        public Task Handle(FundsDepositedEvent @event)
        {
            return(Task.Run(() =>
            {
                var summary = _readRepository.Get(@event.AggregateId);

                summary.Balance += @event.Amount;

                _readRepository.Save(summary);
            }));
        }
 private Task PublishAsync(FundsDepositedEvent @event)
 {
     return(_bus.PublishAsync(@event));
 }
Beispiel #5
0
        public void Deposit(decimal amount, Guid correlationId)
        {
            var deposit = new FundsDepositedEvent(Id, CurrentVersion, correlationId, amount);

            ApplyEvent(deposit);
        }