void IOrginator.SetMemento(IMemento memento) { var clientMemento = (ClientMemento)memento; Id = clientMemento.Id; Version = clientMemento.Version; _clientName = new ClientName(clientMemento.ClientName); _address = new Address(clientMemento.Street, clientMemento.StreetNumber, clientMemento.PostalCode, clientMemento.City); _phoneNumber = new PhoneNumber(clientMemento.PhoneNumber); _accounts.AddRange(clientMemento.Accounts); clientMemento.BankCardMementos.ForEach(x => { var bankCard = new BankCard(); ((IOrginator)bankCard).SetMemento(x); _bankCards.Add(bankCard); }); }
public void UpdateClientName(ClientName clientName) { IsClientCreated(); Apply(new ClientNameChangedEvent(clientName.Name)); }
public static Client CreateNew(ClientName clientName, Address address, PhoneNumber phoneNumber) { return(new Client(clientName, address, phoneNumber)); }
private Client(ClientName clientName, Address address, PhoneNumber phoneNumber) : this() { Apply(new ClientCreatedEvent(Guid.NewGuid(), clientName.Name, address.Street, address.StreetNumber, address.PostalCode, address.City, phoneNumber.Number)); }
private void onClientNameWasChanged(ClientNameChangedEvent clientNameChangedEvent) { _clientName = new ClientName(clientNameChangedEvent.ClientName); }
void IOrginator.SetMemento(IMemento memento) { var clientMemento = (ClientMemento) memento; Id = clientMemento.Id; Version = clientMemento.Version; _clientName = new ClientName(clientMemento.ClientName); _address = new Address(clientMemento.Street, clientMemento.StreetNumber, clientMemento.PostalCode, clientMemento.City); _phoneNumber = new PhoneNumber(clientMemento.PhoneNumber); _accounts.AddRange(clientMemento.Accounts); clientMemento.BankCardMementos.ForEach(x => { var bankCard = new BankCard(); ((IOrginator)bankCard).SetMemento(x); _bankCards.Add(bankCard); }); }
public static Client CreateNew(ClientName clientName, Address address, PhoneNumber phoneNumber) { return new Client(clientName, address, phoneNumber); }
private void onNewClientCreated(ClientCreatedEvent clientCreatedEvent) { Id = clientCreatedEvent.ClientId; _clientName = new ClientName(clientCreatedEvent.ClientName); _address = new Address(clientCreatedEvent.Street, clientCreatedEvent.StreetNumber, clientCreatedEvent.PostalCode, clientCreatedEvent.City); _phoneNumber = new PhoneNumber(clientCreatedEvent.PhoneNumber); }