public object Archive(int?page) { var announcementRepository = new AnnouncementRepository(); var archivedAnnouncements = announcementRepository.GetArchivedAnnouncements(); var pageNumber = page ?? 0; // if no page was specified in the querystring, default to the first page (1) var onePageOfAnnouncements = archivedAnnouncements.ToPagedList(pageNumber, 10); // will only contain 25 products max because of the pageSize ViewBag.OnePageOfAnnouncements = onePageOfAnnouncements; return(View("Archive")); }