Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 private void Apply(ChangeCustomerNameCommand cmd)
 {
     this.UpdateAggregate <CustomerAggregateRoot>(cmd.CustomerId, a => a.ChangeCustomerName(cmd));
 }