public static Manager Create(IIdentity id, string name) { var manager = new Manager(id, name); DomainEvent.OnPublished(new OnManagerCreatedEventArgs(manager)); return(manager); }
public static Bank Create(IIdentity id, string address, Manager.Manager manager, List <Atm> atmList) { var bank = new Bank(id, address, manager, atmList); DomainEvent.OnPublished(new OnBankCreatedEventArgs(bank)); return(bank); }
public Atm NewAtmInstalled(IIdentity id, double cashBalance) { var atm = new Atm(id, cashBalance); _atms.Add(atm); DomainEvent.OnPublished(new OnAtmCreatedEventArgs(atm, Id)); return(atm); }
public void AtmBalanceChanged(IIdentity atmId, double cashBalance) { var atm = Atms.FirstOrDefault(o => o.Id.Equals(atmId)); if (atm == null) { throw new NullReferenceException(); } atm.AddCash(cashBalance); DomainEvent.OnPublished(new OnCashBalanceChangedEventArgs(this, atm)); }