コード例 #1
0
        public ActionResult Detail(int id)
        {
            var movie = new MovieBusiness().GetById(id);
            var comments = new ReviewBusiness().GetAllByMovieId(id);

            return View(new MovieViewModel(movie, comments));
        }
コード例 #2
0
        public ActionResult Index()
        {
            HomeViewModel homeVM = new HomeViewModel();
            homeVM.Top10Best = new List<MovieViewModel>();
            homeVM.Top10Worst = new List<MovieViewModel>();

            var top10 = new MovieBusiness().GetTopTenBestMovies();
            var last10 = new MovieBusiness().GetTopTenWorstMovies();

            foreach(Movie m in top10){
                var reviewBestCount = new ReviewBusiness().GetAllByMovieId(m.id);
                homeVM.Top10Best.Add(new MovieViewModel(m, reviewBestCount));
            }

            foreach (Movie m in last10)
            {
                var reviewBestCount = new ReviewBusiness().GetAllByMovieId(m.id);
                homeVM.Top10Worst.Add(new MovieViewModel(m, reviewBestCount));
            }

            return View(homeVM);
        }