Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //group movie_ids to several genre_strings
- var movieID_genreString_grouping = from mtg in db.MovieToGenres
- join genre in db.Genres on
- mtg.genre_ID equals
- genre.genre_ID
- group genre.genre_string by
- mtg.movie_ID;
- //create the list of NITVMs
- var nitvmQuery =
- //left outer join so that all movies get selected even if there's no omdb match
- from movie in db.Movies
- join omdb in db.Omdb on
- movie.movie_ID equals omdb.movie_ID into mov_omdb_matches
- from mov_omdb_match in mov_omdb_matches.DefaultIfEmpty()
- //match the boxarts
- from boxart in db.BoxArts
- where movie.movie_ID == boxart.movie_ID
- //match the genres string
- from grp in movieID_genreString_grouping
- where grp.Key == movie.movie_ID
- //match the genre id
- //create the NITVM
- select new FullViewModel
- {
- Movie = movie,
- Boxarts = boxart,
- Genres = grp,
- Genre_IDs = (List<int>)(from mtg in db.MovieToGenres
- where mtg.movie_ID == movie.movie_ID
- select mtg.genre_ID),
- //OmdbEntry = (mov_omdb_match == null) ? mov_omdb_match.movie_ID= movie.movie_ID: mov_omdb_match
- OmdbEntry = mov_omdb_match
- };
- //fill the TV Ratings for the dropdown list
- //get all the tv ratings from the db
- IQueryable<FullViewModel> min_tmeter_res = Tools.GetFullDbQuery(new MovieDbContext());
- var all_tmeters = (from fmv in min_tmeter_res
- where fmv.OmdbEntry.t_Meter != null
- select fmv.OmdbEntry.t_Meter).Distinct()
- .OrderBy( item => item);
- var array = all_tmeters.ToArray();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement