void OnEdit() { var organisationDetailsViewModel = new OrganisationDetailsViewModel(this, SelectedOrganisation.Organisation); if (DialogService.ShowModalWindow(organisationDetailsViewModel)) { var organisation = organisationDetailsViewModel.Organisation; SelectedOrganisation.Organisation = organisation; SelectedOrganisation.Update(); ServiceFactory.Events.GetEvent<EditOrganisationEvent>().Publish(organisation); } }
void OnAdd() { var organisationDetailsViewModel = new OrganisationDetailsViewModel(this); if (ServiceFactory.DialogService.ShowModalWindow(organisationDetailsViewModel)) { var organisation = organisationDetailsViewModel.Organisation; var organisationViewModel = new OrganisationViewModel(organisation); Organisations.Add(organisationViewModel); SelectedOrganisation = organisationViewModel; var currentUserViewModel = OrganisationUsersViewModel.Items.FirstOrDefault(x => x.User.UID == ClientManager.CurrentUser.UID); if (currentUserViewModel.User != null) { currentUserViewModel.SetWithoutSave(true); } ServiceFactory.Events.GetEvent<OrganisationUsersChangedEvent>().Publish(SelectedOrganisation.Organisation); } }