Example #1
0
        //
        // GET: /Film/View/id

        public ActionResult View(int?ID)
        {
            if (ID == null)
            {
                return(RedirectToAction("Home", "HomePage"));
            }
            int             filmId     = ID ?? 1;
            FilmDAO         fiDao      = new FilmDAO();
            AccountDAO      accDao     = new AccountDAO();
            CategoryDAO     cDao       = new CategoryDAO();
            CommentDAO      commentDao = new CommentDAO();
            FilmDetailModel model      = new FilmDetailModel
            {
                ListCategory = cDao.GetAllCategory(),
                Account      = null,
                Film         = fiDao.GetDetailAFilm(filmId),
                ListComment  = commentDao.GetAllCommentOfAFilm(filmId)
            };

            return(View(model));
        }
Example #2
0
        //
        // GET: /Film/View/id

        public ActionResult View(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Home", "HomePage"));
            }
            int             filmId     = id ?? 1;
            FilmDAO         fiDao      = new FilmDAO();
            AccountDAO      accDao     = new AccountDAO();
            CategoryDAO     cDao       = new CategoryDAO();
            CommentDAO      commentDao = new CommentDAO();
            FilmDetailModel model      = new FilmDetailModel
            {
                ListCategory = cDao.GetAllCategory(),
                Account      = null,
                Film         = fiDao.GetDetailAFilm(filmId),
                ListComment  = commentDao.GetAllCommentOfAFilm(filmId),
                TopFilm      = fiDao.GetTopFilm(5),
                NewFilm      = fiDao.GetTopNewestFilm(5)
            };

            fiDao.IncreaseViewCount(filmId);//increase viewcount
            return(View(model));
        }