public static void EditPersonDetails(PersonViewModel vm)
 {
     IoCServiceLocator.Bus.Send(
         new ChangePersonDetailsCommand(
             vm.AggregateId,
             vm.Version,
             vm.FirstName,
             vm.LastName,
             vm.IdCard,
             vm.IdNumber));
 }
 private bool IsPersonDirty(PersonViewModel vm)
 {
     var model = QueryStackWorkerService.GetPersonForBankAccount(vm.AggregateId);
     return !model.FirstName.Equals(vm.FirstName.Trim())     ||
            !model.LastName.Equals(vm.LastName.Trim())       ||
            !model.IdCard.Equals(vm.IdCard.Trim())           ||
            !model.IdNumber.Equals(vm.IdNumber.Trim());
 }
        public ActionResult EditCustomer(PersonViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return View(vm);
            }

            if (!this.IsPersonDirty(vm))
            {
                return RedirectToAction("Details", new { id = vm.AggregateId });
            }

            CommandStackWorkerService.EditPersonDetails(vm);
            return RedirectToAction("Details", new { id = vm.AggregateId });
        }