// GET: Blog public ActionResult Index() { string section = "blog"; string qString = "/blog"; Language language = new Language("en-US"); ContentPage contentPage = new ContentPage(qString); if (contentPage.PageID != Guid.Empty) { ViewData = contentPage.GetSections(); ViewBag.Meta = contentPage.MetaTags; MenuItem sideMenu = new MenuItem(Request.Url.AbsolutePath); ViewBag.SideMenu = sideMenu.SiblingMenuCode(); ViewBag.Highlight = "$('." + section + "').addClass('active');"; } ViewBag.BlogHeaderExt = "Blog"; //Paging defaults int pg = 1; int sz = 20; //Retrieve / Store paging parameters if (Request.QueryString["pg"] != null) { if (!Int32.TryParse(Request.QueryString["pg"].ToString(), out pg)) { pg = 1; } } if (Request.QueryString["sz"] != null) { if (!Int32.TryParse(Request.QueryString["sz"].ToString(), out sz)) { sz = 20; } } BlogPosts posts = new BlogPosts(); List <BlogPost> blogs = posts.AllPosts(pg, sz); ViewBag.Pager = posts.AllPostsPager(pg, sz); return(View(blogs)); }