public void ChangeCustomerName(ChangeCustomerNameCommand cmd) { if (string.IsNullOrWhiteSpace(cmd.FirstName)) { throw new ArgumentNullException(cmd.FirstName); } if (string.IsNullOrWhiteSpace(cmd.LastName)) { throw new ArgumentNullException(cmd.LastName); } if (this.State.FirstName.Equals(cmd.FirstName) && this.State.LastName.Equals(cmd.LastName)) { return; } this.Apply(new CustomerNameChanged(this.Id, cmd.FirstName, cmd.LastName, this.GetNextVersion(), cmd.CommandId)); }
private void Apply(ChangeCustomerNameCommand cmd) { this.UpdateAggregate <CustomerAggregateRoot>(cmd.CustomerId, a => a.ChangeCustomerName(cmd)); }