Example #1
0
        public ActionResult GetPostsByDate(int year, int month, int?page)
        {
            ViewBag.Title  = "Posts - " + new DateTime(year, month, 1).ToString("y");
            ViewBag.Action = "GetPostsByDate";
            ViewBag.Year   = year;
            ViewBag.Month  = month;
            ViewBag.Route  = "PostByDate";
            var pageIndex = page ?? 0;

            if ((CodeFirstSecurity.IsAuthenticated) && (CodeFirstRoleServices.IsUserInRole(CodeFirstSecurity.CurrentUserName, BgResources.Security_PremiumRole)))
            {
                return(View("Posts", BlogServices.FindPagedPostsByDate(true, year, month, pageIndex, Int32.Parse(BgResources.Pager_PostPerPage))));
            }
            else
            {
                return(View("Posts", BlogServices.FindPagedPostsByDate(false, year, month, pageIndex, Int32.Parse(BgResources.Pager_PostPerPage))));
            }
        }