private void onClick_Add(object sender, RoutedEventArgs e) { ShowRecord record = (ShowRecord)imdbShows.SelectedItem; ShowRecord newRecord = _repo.addFromImdb(record.imdbID); _show.Title = newRecord.Title; _show.Genre = newRecord.Genre; _show.IsFinished = false; _show.totalSeasons = newRecord.totalSeasons; _show.imdbID = newRecord.imdbID; MessageBoxResult result = MessageBox.Show("Are you sure you want to add the following show?" + "\nName of the show: " + _show.Title + "\nGenre of the show: " + _show.Genre + "\nTotal seasons in the show: " + newRecord.totalSeasons, "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { if (!_repo.addNewShow(_show)) { MessageBox.Show("The show with the same name already exists"); } else { var showEpisodes = _repo.getEpisodesInSeasons(_show.imdbID); var id = _repo.getIdOfExistingShow(_show.Title); _repo.addEpisodesToShow(id, showEpisodes); MessageBox.Show("The new show has been added. Please select your current episode"); ViewAllEpisodes eps = new ViewAllEpisodes(_show.Title); eps.episodes.ItemsSource = _repo.getAllEpisodesInShow(_show.Title); eps.Show(); } } }