public void UpdateCategorie() { CategorieDataService cds = new CategorieDataService(); ValidationMessage = "This field is required."; // controleren of het veld "naam" is ingevuld met validatie if (MyValidation.ControleForm(SelectedCategorie.Naam)) { return; } else { ValidationMessage = ""; // controleren of de categorie al bestaat in de database string _categorieBestaat = cds.CategorieNaamExist(SelectedCategorie.Naam); if (_categorieBestaat != null) { MessageBox.Show("This Category already exists.", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } else { // controleren of update of insert moet zijn if (SelectedCategorie.Id == 0) { cds.InsertCategorie(SelectedCategorie); Messenger.Default.Send <UpdateFinishedMessage>(new UpdateFinishedMessage(UpdateFinishedMessage.MessageType.Inserted)); } else { cds.UpdateCategorie(SelectedCategorie); Messenger.Default.Send <UpdateFinishedMessage>(new UpdateFinishedMessage(UpdateFinishedMessage.MessageType.Updated)); } } } }