public ActionResult BlogPostIndex(PostIndexModel model) { PagedData<ContentPage> pagedData = model.Page; pagedData.ToggleSort(); var srt = pagedData.ParseSort(); if (model.SelectedSearch == PageIndexModel.SearchBy.AllPages) { pagedData.TotalRecords = pageHelper.GetSitePageCount(this.SiteID, ContentPageType.PageType.BlogEntry, false); pagedData.DataSource = pageHelper.GetPagedSortedContent(this.SiteID, ContentPageType.PageType.BlogEntry, false, pagedData.PageSize, pagedData.PageNumberZeroIndex, pagedData.OrderBy); } else { IQueryable<ContentPage> query = pageHelper.GetPostsByDateRange(this.SiteID, model.SearchDate, model.SelectedRange, false).AsQueryable(); query = query.SortByParm<ContentPage>(srt.SortField, srt.SortDirection); pagedData.DataSource = query.ToList(); pagedData.TotalRecords = pagedData.DataSource.Count(); pagedData.PageSize = 1 + (pagedData.TotalRecords * 2); } ModelState.Clear(); return View(model); }
public ActionResult BlogPostIndex() { CMSConfigHelper.CleanUpSerialData(); PostIndexModel model = new PostIndexModel(); model.SelectedSearch = PageIndexModel.SearchBy.AllPages; PagedData<ContentPage> pagedData = new PagedData<ContentPage>(); pagedData.PageSize = 10; pagedData.InitOrderBy(x => x.GoLiveDate, false); model.Page = pagedData; return BlogPostIndex(model); }