private Movie getMovie(MoviePreview selectedMovie) { string link = selectedMovie.PageLink; HtmlWeb web = new HtmlWeb(); HtmlDocument doc = web.Load(link); extractMovieDetails(doc); Movie movie = new Movie(movieName, moviePlot, movieYear, movieGenre, movieCast); return(movie); }
/// <summary> /// Gather all the data from the movie table, build a MoviePreview object and add it to moviesFound list /// </summary> private void addMoviesToList() { foreach (DataRow row in movieTable.Rows) { string icon = (string)row[0]; string name = (string)row[1]; int year = (int)(row[2]); string pageLink = (string)row[3]; //create the MoviePreview object MoviePreview movie = new MoviePreview(name, icon, year, pageLink); moviesFound.Add(movie); } }
public void addMovieToCollection(MoviePreview selectedMovie) { movieName = selectedMovie.MovieName; movieYear = selectedMovie.YearReleased; Movie movieToAdd = getMovie(selectedMovie); //check if the movie already exist in our collection if (!myCollection.Contains(movieToAdd)) { myCollection.Add(movieToAdd); } else { MessageBox.Show(String.Format("The movie {0} is already in the list", movieToAdd)); } }