Exemple #1
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are the new details correct?" +
                                                      "\nTitle: " + titlebox.Text +
                                                      "\nSeason: " + Int32.Parse(seasonBox.Text) +
                                                      "\nEpisode: " + Int32.Parse(episodeBox.Text),
                                                      "   Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                _record.Title   = titlebox.Text;
                _record.Season  = Int32.Parse(seasonBox.Text);
                _record.Episode = Int32.Parse(episodeBox.Text);
                _record.ShowId  = _repo.findEpisodesShowId(_record.Title);
                if (_record.Title == _oldTitle)
                {
                    _repo.editEpisode(_record, _oldTitle);
                    this.Close();
                }
                else if (!_repo.checkIfEpisodeAlreadyExists(_record))
                {
                    _repo.editEpisode(_record, _oldTitle);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("The episode with the same name already exists for this show");
                    titlebox.Text = _oldTitle;
                }
            }
        }