示例#1
0
 public ActionResult Index(int?page)
 {
     if (User.Identity.IsAuthenticated)
     {
         var person    = PersonRepository.GetPersonByEmail(User.Identity.Name, true);
         var movies    = new List <MovieViewModel>();
         var BLLmovies = new List <BLL.Movie>();
         #region Getting recommended movies here
         BLLmovies = Recommender.Recommend(person).ToList();
         //BLLmovies = MovieProvider.RecommendMovies();
         foreach (var BLLmovie in BLLmovies)
         {
             if (BLLmovie.Title == "" || BLLmovie.PosterPath == null || BLLmovie.PosterPath == "")
             {
                 continue;
             }
             var movie = new MovieViewModel();
             movie.CastSimpleFromMovie(BLLmovie);
             movies.Add(movie);
         }
         #endregion
         int pageSize   = 9;
         int pageNumber = (page ?? 1);
         return(View("HomeLoggedIn", movies.ToPagedList(pageNumber, pageSize)));
     }
     else
     {
         return(View());
     }
 }