public static Film ReadMovieFromCollection(this string title)
 {
     Film = (from flick in Context.Films
             where flick.Title == title
             select flick).ToList().FirstOrDefault();
     return Film;
 }
 public static List<string> GetFilmGenreNames(Film filmToSearchOn)
 {
     return filmToSearchOn.GenreFilmIndexes.Select(index => index.Genre.Name).ToList();
 }
        public static bool AddMovieToCollection(this IMDB movie)
        {
            try
            {
                if (AddMovieToDB(movie))
                {
                    AddGenresFromMovie(movie);
                    AddPeopleFromMovie(movie);
                    SaveAndRefreshDBConnection();

                    //retrieve for DB assigned id
                    Film = ReadMovieFromCollection(movie.Title);

                    AddGenreFilmIndexes(Film.FilmID, movie);

                    AddPersonFilmIndexesFromMovie(Film.FilmID, movie);

                    SaveAndCloseDBConnection();
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                ex.ThrowFormattedException();
            }
            return false;
        }
Esempio n. 4
0
        private void ShowMovie()
        {
            _currentlyShowing = _films.First();
                resultTree.Items.Add( _currentlyShowing.GetTreeItem());

                foreach (TreeViewItem tn in from TreeViewItem root in resultTree.Items
                                            from TreeViewItem tn in root.Items
                                            where (tn.Header.ToString().Contains("QuickInfo"))
                                            || (tn.Header.ToString().Contains("Plot")) select tn)
                {
                    tn.ExpandSubtree();
                }
        }
 /// <summary>
 /// Create a new Film object.
 /// </summary>
 /// <param name="filmID">Initial value of the FilmID property.</param>
 /// <param name="length">Initial value of the Length property.</param>
 /// <param name="year">Initial value of the Year property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="movieRating">Initial value of the MovieRating property.</param>
 public static Film CreateFilm(global::System.Int32 filmID, global::System.Int32 length, global::System.Int32 year, global::System.String title, global::System.Int32 movieRating)
 {
     Film film = new Film();
     film.FilmID = filmID;
     film.Length = length;
     film.Year = year;
     film.Title = title;
     film.MovieRating = movieRating;
     return film;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Films EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFilms(Film film)
 {
     base.AddObject("Films", film);
 }