public Amount Withdrawal(Amount amount, DateTime dateTime) { if (amount.isNegative()) { throw new Exception("Impossible to make the withdrawal : negative amount"); } _balance.DecreaseAmount(amount); Operation withdrawal = new Withdrawal(amount, dateTime); _operations.AddOperation(withdrawal); return(amount); }
public void Deposit(Amount amount, DateTime dateTime) { if (amount.isNegative()) { throw new Exception("Impossible to make the deposit : negative amount"); } if (amount.isPositive()) { _balance.IncreaseAmount(amount); Operation deposit = new Deposit(amount, dateTime); _operations.AddOperation(deposit); } }