private Section LoadSubSection(Section model, OwnerSectionCache ownerSectionCache) { //Evaluate if this section should be displayed if (SitecoreUtils.EvaluateRules(model.RestrictionRule, model.InnerItem)) { model.HideSection = false; var context = new SitecoreContext(); var homePage = context.GetHomeItem <BasePage>(); BlueGreenContext bgContext = new BlueGreenContext(); string ownerId = bgContext.OwnerId; if (model.LazyLoadContent) { } else { OwnerUtils.GetSectionTableData(ref model, ownerId, homePage.SiteSettings, ownerSectionCache); } } else { model.HideSection = true; } return(model); }
public ActionResult Section() { DebugUtils.StartLogEvent("OwnerController.Section"); var model = new Section(); OwnerSectionCache ownerSectionCache = new OwnerSectionCache(); if (Request.QueryString["SectionType"] != null) { var resultViews = new List <KeyValuePair <string, string> >(); var lazyLoadSectionId = Request.QueryString["SectionType"].ToString(); var sectionIds = lazyLoadSectionId.Split(','); foreach (var id in sectionIds) { var context = new SitecoreContext(); model = context.GetItem <Section>(id); if (model != null) { model.LazyLoadContent = false; model.showSectionTitle = false; model = LoadSubSection(model, ownerSectionCache); if (!model.HideSection) { var totalValuesPartialView = RenderRazorViewToString(this.ControllerContext, "section", model); resultViews.Add(new KeyValuePair <string, string>(id, totalValuesPartialView)); } } } DebugUtils.EndLogEvent("OwnerController.Section"); return(Json(resultViews, JsonRequestBehavior.AllowGet)); } else { model = GetLayoutItem <Section>(); model.showSectionTitle = true; model = LoadSubSection(model, ownerSectionCache); DebugUtils.EndLogEvent("OwnerController.Section"); if (model.HideSection) { return(new EmptyResult()); } else { return(View(model)); } } }