// GET: Blog/month/{month} public ActionResult IndexMonth(string month) { 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');"; } DateTime currentMonth; if (DateTime.TryParse(month.Substring(0, 2) + "/1/" + month.Substring(2), out currentMonth)) { ViewBag.BlogHeaderExt = "Blogs From: " + currentMonth.ToString("MMMM yyyy"); } else { ViewBag.BlogHeaderExt = "Blogs From: " + month.Substring(0, 2) + "-" + month.Substring(2); } //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.PostsInMonth(month, pg, sz); ViewBag.Pager = posts.MonthPager(month, pg, sz); return(View("Index", blogs)); }