private void button_Save(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Are the new details correct?" + "\nName of the show: " + namebox.Text + "\nGenre of the show: " + genreBox.Text + "\nTotal seasons in the show: " + Int32.Parse(seasonsCountBox.Text) + "\nCurrent season: " + Int32.Parse(currentSeasonBox.Text) + "\nCurrent episode: " + Int32.Parse(currentEpBox.Text) + "\nHave you finished watching the show? " + isFinishedBox.IsChecked.Value, "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { _show = new ShowRecord(); _show.Title = namebox.Text; _show.Genre = genreBox.Text; _show.CurrentEpisode = Int32.Parse(currentEpBox.Text); _show.CurrentSeason = Int32.Parse(currentSeasonBox.Text); _show.IsFinished = isFinishedBox.IsChecked.Value; _show.totalSeasons = Int32.Parse(seasonsCountBox.Text); if (_show.Title == _oldTitle) { _repo.editShow(_show, _oldTitle); this.Close(); } else if (!_repo.checkIfShowAlreadyExists(_show)) { _repo.editShow(_show, _oldTitle); this.Close(); } else { MessageBox.Show("The show with the same name already exists"); namebox.Text = _oldTitle; } } }