Ejemplo n.º 1
0
        void OnCommit()
        {
            DbConversation.UsingTransaction(() =>
            {
                if (EditMode == EditMode.Add)
                {
                    DbConversation.Insert(CurrentEdit);
                    EventAggregator.GetEvent <UserAddedEvent>().Publish(CurrentEdit);
                }
                else
                {
                    foreach (var user in _editedUsers)
                    {
                        if (CurrentEdit.Name != null)
                        {
                            user.Name = CurrentEdit.Name;
                        }
                        if (CurrentEdit.UserRole != null)
                        {
                            user.UserRole = CurrentEdit.UserRole;
                        }
                        EventAggregator.GetEvent <UserChangedEvent>().Publish(user);
                    }
                }
            });

            if (_navigationJournal != null)
            {
                _navigationJournal.GoBack();
            }
        }
Ejemplo n.º 2
0
 public void Save()
 {
     if (!SuccessfullySaved(() => DbConversation.Insert(Element.UserRole)))
     {
         return;
     }
     EventAggregator.Publish(new UserRoleChangedEvent(Element.UserRole));
     TryClose();
 }