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


            ViewBag.ViewForCountry = true;
            ViewBag.countryID = countryID;


            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.findByCountry(countryID, page, TempData["strSort"].ToString(), false);

            List<Phim> lstPhimSearch = phimService.findAllByCountry(countryID);

            ViewBag.maxPage = phimService.countPageSearch(lstPhimSearch);



            return View("Index", lstPhim);
        }