コード例 #1
0
        // GET: Images
        public ActionResult Index(int?page, int?album, string search)
        {
            var images = imageHandler.All();

            // Filter:
            if (album != null && album != 0)
            {
                images = images.Where(im => im.Albums.id == album);
            }

            // Search:
            images = imageHandler.Search(images, search);

            List <Albums> albumList = albumHandler.All().ToList();

            albumList.Insert(0, new Albums {
                id = 0, title = "All"
            });
            ViewBag.Albums = new SelectList(albumList, "id", "title");

            int pageSize   = PagingSettings.PageSizeInAlbum;
            int pageNumber = (page ?? 1);

            return(View(images.ToPagedList(pageNumber, pageSize)));
        }
コード例 #2
0
        // 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)));
        }