Example #1
0
        private void Save(object value)
        {
            if (this.person.Id > 0)
            {
                // update database ..
                tracker.AcceptChanges();
                eventAggregator.GetEvent <PersonUpdatedSuccesfullyEvent>().Publish(new PersonEventArgs {
                    Id = person.Id, DisplayName = person.FirstName
                });
            }
            else
            {
                // validation ... save
                fakePeopleService.Add(person);
                tracker.AcceptChanges();
                eventAggregator.GetEvent <PersonAddedEvent>().Publish(new PersonEventArgs {
                    Id = person.Id, DisplayName = person.FirstName
                });
            }

            SaveMessage = $"Save: {person.Id}, {person.FirstName} {person.LastName}, {person.EmailAddress} {value} {DateTime.Now.ToLongTimeString()}";
        }