public Deposit(int id, Account account, decimal amount) { ID = id; CreatedOn = DateTime.Now; _account = account; _amount = amount; Status = Enum.CommandState.Unprocessed; }
public Withdraw(int ID, Account account, decimal amount) { ID = ID; CreatedOn = DateTime.Now; _account = account; _amount = amount; Status = Enum.CommandState.Unprocessed; }
public void Undo() { if (_account.Balance >= _amount) { _account.Balance -= _amount; Status = Enum.CommandState.UndoSucceeded; } else { Status = Enum.CommandState.UndoFailed; } }
public void Execute() { if (_account.Balance >= _amount) { _account.Balance -= _amount; Status = Enum.CommandState.ExecuteSucceeded; } else { Status = Enum.CommandState.ExecuteFailed; } }
public void Execute() { _account.Balance += _amount; Status = Enum.CommandState.ExecuteSucceeded; }
public void Undo() { _account.Balance += _amount; Status = Enum.CommandState.UndoSucceeded; }