public ActionResult Edit(UserWantsToChangeCustomerName userWantsToChangeCustomerName)
        {
            if (ModelState.IsValid)
            {
                this.Publish(userWantsToChangeCustomerName);
                return(RedirectToAction("Index"));
            }

            return(View(userWantsToChangeCustomerName));
        }
        public void Handle(UserWantsToChangeCustomerName @event)
        {
            if (!BusinessRule.CustomerMustExist.IsSatisifedBy(this.State))
            {
                this.Publish(new UserWantsToChangeCustomerNameFailed {
                    Name = @event.Name, Reason = "The customer does not exists."
                });
            }

            if (!BusinessRule.NameMustBeAlphaNumeric.IsSatisifedBy(@event.Name))
            {
                this.Publish(
                    new UserWantsToChangeCustomerNameFailed
                {
                    Name = @event.Name, Reason = "The customer name is not valid."
                });
                return;
            }

            this.Publish(new CustomerNameChangedByUser {
                CustomerId = this.Id, Name = @event.Name,
            });
        }
 public void Handle(UserWantsToChangeCustomerName @event)
 {
     Handle(@event.CustomerId, @event);
 }