void OnAdd() { var documentTypeDetailsViewModel = new DocumentTypeDetailsViewModel(SelectedDocumentType.Organisation.UID); if (DialogService.ShowModalWindow(documentTypeDetailsViewModel)) { if (DocumentTypeHelper.Add(documentTypeDetailsViewModel.TimeTrackDocumentType)) { var documentViewModel = new DocumentTypeViewModel(SelectedDocumentType.Organisation, documentTypeDetailsViewModel.TimeTrackDocumentType); DocumentTypeViewModel OrganisationViewModel = SelectedDocumentType; if (!OrganisationViewModel.IsOrganisation) OrganisationViewModel = SelectedDocumentType.Parent; if (OrganisationViewModel == null || OrganisationViewModel.Organisation == null) return; OrganisationViewModel.AddChild(documentViewModel); SelectedDocumentType = documentViewModel; } } }
void OnEdit() { var documentTypeDetailsViewModel = new DocumentTypeDetailsViewModel(SelectedDocumentType.Organisation.UID, SelectedDocumentType.TimeTrackDocumentType); if (DialogService.ShowModalWindow(documentTypeDetailsViewModel)) { if (DocumentTypeHelper.Edit(documentTypeDetailsViewModel.TimeTrackDocumentType)) { SelectedDocumentType.Update(documentTypeDetailsViewModel.TimeTrackDocumentType); } } }