public ActionResult HealthIS_Blog_CategoryAndTagPage(int?page) { HealthIS.Apps.MVC.Blog.Models.ListPage lp = new HealthIS.Apps.MVC.Blog.Models.ListPage(); lp.PageSize = Int32.Parse(lp.CurrentPage.Fields["Page Size"].Value); if (Request["name"] == null || String.IsNullOrEmpty(Request["name"].Trim())) { lp.ParameterName = "No Result Found"; //return PartialView(lp); return(Redirect("/is/blog")); } string searchTerm = Request["name"].ToLower().Trim(); string filterName = ""; if (lp.CurrentPage.Name.ToLower().Trim() == "category" && Request["name"] != null) { filterName = "healthisblogcategory"; Item categoryItem = lp.CategoryRepository.Axes.GetDescendants().Where(d => d.Fields["Key"].Value.ToLower() == searchTerm).FirstOrDefault(); if (categoryItem != null) { lp.ParameterName = categoryItem.Fields["Phrase"].Value; } else { lp.ParameterName = searchTerm; } } else if (lp.CurrentPage.Name.ToLower().Trim() == "tag" && Request["name"] != null) { filterName = "healthisblogtag"; lp.ParameterName = searchTerm; } else { return(PartialView(lp)); } if (!String.IsNullOrEmpty(filterName)) { if (String.IsNullOrEmpty(searchTerm)) { searchTerm = ""; } lp.AllArticles = TaxonomyFilter.GetSearchPredicate(lp.CurrentPage, filterName, searchTerm) .Where(l => l != null && l.Versions.IsLatestVersion()) //.Distinct() .OrderBy(o => o.Statistics.Created) .Reverse() .ToList(); } return(PartialView(lp)); }
public ActionResult HealthIS_Blog_HomePage(int?page) { HealthIS.Apps.MVC.Blog.Models.ListPage lp = new HealthIS.Apps.MVC.Blog.Models.ListPage(); lp.PageSize = Int32.Parse(Sitecore.Context.Item.Fields["Page Size"].Value); lp.AllArticles = lp.ArticleRootPath.Axes.GetDescendants() .Where(l => l.Versions.IsLatestVersion()) .Where(t => t.TemplateName == lp.ArticleTemplateName) .OrderBy(o => o.Statistics.Created) .Reverse() .ToList(); return(PartialView(lp)); }
public ActionResult HealthIS_Blog_AuthorPage(int?page) { HealthIS.Apps.MVC.Blog.Models.ListPage lp = new HealthIS.Apps.MVC.Blog.Models.ListPage(); string searchTerm = Request["username"] == null ? "" : Request["username"].ToLower().Trim(); lp.PageSize = Int32.Parse(Sitecore.Context.Item.Fields["Page Size"].Value); if (String.IsNullOrEmpty(Request["username"]) || Request["username"] == null) { return(Redirect("/is/blog")); } else { lp.AllArticles = lp.ArticleRootPath.Axes.GetDescendants() .Where(l => l.Versions.IsLatestVersion()) .Where(t => t.TemplateName == lp.ArticleTemplateName) .Where(c => c.Statistics.CreatedBy.Replace("\\", "").Equals(searchTerm)) .OrderBy(o => o.Statistics.Created) .Reverse() .ToList(); } return(PartialView(lp)); }