public Deposit(int id, Account account, decimal amount) { Id = id; CreatedOn = DateTime.UtcNow; _account = account; _amount = amount; Status = AccountCommandState.Unprocessed; }
public Transfer(int id, Account fromAccount, Account toAccount, decimal amount) { Id = id; CreatedOn = DateTime.UtcNow; _fromAccount = fromAccount; _toAccount = toAccount; _amount = amount; Status = AccountCommandState.Unprocessed; }
public void Execute() { if (_account.Balance >= _amount) { _account.Balance -= _amount; Status = AccountCommandState.ExecuteSucceeded; } else { Status = AccountCommandState.ExecuteFailed; } }
public void Execute() { _account.Balance += _amount; Status = AccountCommandState.ExecuteSucceeded; }