Exemplo n.º 1
0
        public ActionResult ViewForGenre(String genreID, int? page, String strSort)
        {
            TempData["strSort"] = strSort;
            if(genreID == null) //Nếu không xem them thể loại thì xem tất cả các phim
            {
                return RedirectToAction("Index");
            }

            ViewBag.ViewForGenre = true;
            ViewBag.genreID = genreID;


            ViewBag.HomeStatus = "inactive";
            ViewBag.VideoStatus = "inactive";
            ViewBag.ReviewStatus = "active";
            ViewBag.ContactStatus = "inactive";


            if (page == null)
            {
                if (TempData["currentPage"] != null)
                {
                    page = Int32.Parse(TempData["currentPage"].ToString()); //Chuyển hướng từ action delete
                }
                else
                {
                    page = 1;
                    TempData["currentPage"] = page;
                }
            }
            else
                TempData["currentPage"] = page;

            if (TempData["strSort"] == null)
                TempData["strSort"] = "ID";
        
            FilmService phimService = new FilmService();
            ViewBag.maxIndexPage = phimService.getMaxIndexPage();

        

            List<PhimViewModels> lstPhim = phimService.findByGenre(genreID, page, TempData["strSort"].ToString(), false);

            List<Phim> lstPhimSearch = phimService.findAllByGenry(genreID);

            ViewBag.maxPage = phimService.countPageSearch(lstPhimSearch);
          

            return View("Index", lstPhim);
        }