private void Add_User(object sender, RoutedEventArgs e) { UserEditorDialog userEditor = new UserEditorDialog(ViewModel.Model); if (userEditor.ShowDialog() == true) { ViewModel.AddUser(userEditor.User, userEditor.NewPassword); } }
private void Edit_User(object sender, RoutedEventArgs e) { UserEditorDialog userEditor = new UserEditorDialog(ViewModel.Model, ViewModel.SelectedUser); if (userEditor.ShowDialog() == true) { IUser user = userEditor.User; switch (userEditor.EditedField) { case UserEditorDialog.UserField.NAME: ViewModel.SaveUserName(user.UserID, user.Username); break; case UserEditorDialog.UserField.PASS: ViewModel.SaveUserPass(user.UserID, userEditor.NewPassword); break; case UserEditorDialog.UserField.TYPE: ViewModel.SaveUserType(user.UserID, user.UserType); break; } } }