示例#1
0
        public ActionResult Details(string imdbID)
        {
            var repo        = new MovieRepository();
            var movie       = new MovieViewModel();
            var movieFromDB = new BLL.Movie();

            movieFromDB = repo.GetMovieByIDShortDetails(imdbID);
            movie.CastFromMovie(movieFromDB);
            return(View(movie));
        }
示例#2
0
        public async Task <int> IMDB()
        {
            var              IMDB    = new TMDbClient("2c54085e8a7f520650d65cb78a48555a");
            OMDbClient       omdb    = new OMDbClient(true);
            int              counter = 0;
            List <BLL.Movie> rez     = new List <BLL.Movie>();

            // 54001
            for (int j = 64852; j <= 624852; j += 100)
            {
                for (int i = j; i < j + 100; i++)
                {
                    TMDbLib.Objects.Movies.Movie pom = new TMDbLib.Objects.Movies.Movie();
                    try
                    {
                        pom = await IMDB.GetMovieAsync(i, MovieMethods.Credits | MovieMethods.Similar | MovieMethods.Videos | MovieMethods.Reviews | MovieMethods.Keywords);

                        if (pom.ImdbId != "" && pom.ImdbId != null && pom.ImdbId.Length > 0)
                        {
                            var newMovie = new BLL.Movie
                            {
                                IMDbId      = pom.ImdbId,
                                Id          = pom.Id,
                                Title       = pom.Title,
                                Runtime     = pom.Runtime,
                                Credits     = pom.Credits,
                                Genres      = pom.Genres,
                                Keywords    = pom.Keywords,
                                Overview    = pom.Overview,
                                Popularity  = pom.Popularity,
                                PosterPath  = pom.PosterPath,
                                ReleaseDate = pom.ReleaseDate,
                                Reviews     = pom.Reviews,
                                Similar     = pom.Similar,
                                Status      = pom.Status,
                                Videos      = pom.Videos,
                                VoteAverage = pom.VoteAverage,
                                VoteCount   = pom.VoteCount
                            };
                            newMovie = movieRepo.OMDbData(newMovie);
                            newMovie = movieRepo.SubtitleData(newMovie);
                            rez.Add(newMovie);
                        }
                    }
                    catch
                    {
                        if (rez != null && rez.Count > 0)
                        {
                            baza.saveMovies(rez);
                            rez = new List <BLL.Movie>();
                        }
                    }
                }
                if (rez.Count > 0)
                {
                    baza.saveMovies(rez);
                    rez = new List <BLL.Movie>();
                }

                counter = j;
            }
            return(counter);
        }