public void MakeCashTransaction(Date transactionDate, BankAccountTransactionType type, decimal amount, string comment, Guid transactionId) { var @event = new CashTransactionOccurredEvent(Id, Version, transactionId, transactionDate, comment) { CashTransactionType = type, Amount = amount }; Apply(@event); PublishEvent(@event); }
public void Apply(CashTransactionOccurredEvent @event) { var cashTransaction = new CashTransaction { Id = @event.TransactionId, Date = @event.Date, Stock = null, Comment = @event.Comment, CashTransactionType = @event.CashTransactionType, Amount = @event.Amount }; var handler = _TransactionHandlers.GetService <CashTransaction>(); handler.Apply(cashTransaction, null, _CashAccount); _Transactions.Add(cashTransaction); }