public ActionResult Index(string inputSearch) { int page = 1; if (!String.IsNullOrWhiteSpace(inputSearch)) { MoviessListViewModel model = new MoviessListViewModel { MoviesListAll = db.Movies, moviespage = db.Movies .Where(m => m.NameM.Contains(inputSearch)) .OrderByDescending(s => s.DownloadDate) .Skip((page - 1) * pageSize) .Take(pageSize), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = db.Movies.Count() } }; return(View(model)); } else { return(RedirectToAction("Movie", "Home")); } }
public ActionResult Index(int page = 1) { MoviessListViewModel model = new MoviessListViewModel { MoviesListAll = db.Movies, moviespage = db.Movies .OrderByDescending(s => s.DownloadDate) .Skip((page - 1) * pageSize) .Take(pageSize), PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = db.Movies.Count() } }; return(View(model)); }
public ActionResult newsMovie(int page = 1) { MoviessListViewModel model = new MoviessListViewModel { MoviesListAll = db.Movies, moviespage = db.Movies .Where(m => m.Age == 2018) .OrderByDescending(s => s.DownloadDate) .Skip((page - 1) * pageSize) .Take(pageSize) }; model.PagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = model.moviespage.Count() }; return(View("Index", model)); }