// GET: Albums public ActionResult Index(int?page, int?language, string search) { var albums = albumHandler.All(); // Filter: if (language != null && language != 0) { albums = albums.Where(m => m.language_id == language); } // Search: albums = albumHandler.Search(albums, search); List <Languages> languageList = languageHandler.All().ToList(); languageList.Insert(0, new Languages { id = 0, title = "All" }); ViewBag.Language = new SelectList(languageList, "id", "title"); int pageSize = PagingSettings.PageSizeInAlbum; int pageNumber = (page ?? 1); return(View(albums.ToPagedList(pageNumber, pageSize))); }