public ActionResult Details(int movie_ID = 0)
        {
            MovieDbContext db = new MovieDbContext();
            FullViewModel fullView = new FullViewModel();

            Movie movie = db.Movies.Find(movie_ID);
            if (movie == null) {
                return View("Error");
            }

            fullView.Movie = movie;
            fullView.Genres = PopulateFullView.Genres(movie_ID);
            fullView.Boxarts = PopulateFullView.BoxArts(movie_ID);
            fullView.OmdbEntry = PopulateFullView.Omdb(movie_ID);
            fullView.Tags = PopulateFullView.TagsAndCount(movie_ID);
            //added the plot to the fullView too, needs the whole movie, for the title and year
            fullView.Plot = PopulateFullView.Plot(movie);

            return View(fullView);
               // return View("Details2", fullView);
        }
예제 #2
0
        public static List<FullViewModel> MatchListOfMwgvmWithOmdbEntrys(List<MovieWithGenreViewModel> MwG_list,
                                                                             MovieDbContext db)
        {
            //create complete view models based on MwGs
            List<FullViewModel> completeVm_list = new List<FullViewModel>();
            foreach (MovieWithGenreViewModel movieWithGenreViewModel in MwG_list) {
                //find the omdbEntry for the mwgvm that matches the title and year
                //TODO: fix omdb matching, for episodes
                var matching_oe =
                    db.Omdb.First(
                        item =>
                        item.title == movieWithGenreViewModel.movie.short_title &&
                        item.year == movieWithGenreViewModel.movie.year);

                //create a NITViewModel from the MwGVM and OmdbEntry
                var created_vm = new FullViewModel
                                     {
                                         Movie =
                                             movieWithGenreViewModel.movie,
                                         Genres =
                                             movieWithGenreViewModel
                                             .genre_strings,
                                         Boxarts = movieWithGenreViewModel.boxart,
                                         OmdbEntry = matching_oe
                                     };
                //add the viewmodel to the list to be returned to the view
                completeVm_list.Add(created_vm);
            }
            return completeVm_list;
        }