void OnAdd() { var userDetailsViewModel = new UserDetailsViewModel(); if (DialogService.ShowModalWindow(userDetailsViewModel)) { DbCache.AddJournalForUser(JournalType.AddUser, userDetailsViewModel.User); var userViewModel = new UserViewModel(userDetailsViewModel.User); Users.Add(userViewModel); SelectedUser = userViewModel; } }
void OnEdit() { var userDetailsViewModel = new UserDetailsViewModel(SelectedUser.User); if (DialogService.ShowModalWindow(userDetailsViewModel)) { SelectedUser.User = userDetailsViewModel.User; if (DbCache.CurrentUser != null && DbCache.CurrentUser.UID == userDetailsViewModel.User.UID) DbCache.CurrentUser = userDetailsViewModel.User; Bootstrapper.MainViewModel.UpdateTabsIsVisible(); if (userDetailsViewModel.IsChange) DbCache.AddJournalForUser(JournalType.EditUser, SelectedUser.User); } }