public static SitecoreContext GetFromHttpContext(string contextName = null) { if (string.IsNullOrEmpty(contextName)) { contextName = GetContextFromSite(); } var cachedContexts = CachedContexts; if (cachedContexts == null) { return(new SitecoreContext(contextName)); } else { SitecoreContext context = null; if (cachedContexts.ContainsKey(contextName)) { context = cachedContexts[contextName]; } if (context == null) { context = new SitecoreContext(contextName); cachedContexts[contextName] = context; } return(context); } }
public List<CategoryItem> GetCategories() { //return new List<Category>(); var context = new SitecoreContext(); List<CategoryItem> categories = new List<CategoryItem>(); categoryList = context.GetItem<CategoryList>(CATEGORY_ROOT_GUID); var categoryBucket = categoryList.Children.Select(a => new Category() { CategoryId = a.CategoryId, Title = a.Title, Description = a.Description, SmallImage = a.SmallImage }).ToList<Category>().Where(x => x.Title != null); foreach (var v in categoryBucket) { categories.Add(new CategoryItem() { CategoryId=v.CategoryId, Title=v.Title, Description=v.Description, SmallImage=v.SmallImage }); } return categories; }
protected void Page_Load(object sender, EventArgs e) { var context = new SitecoreContext(); Model = context.GetCurrentItem<Homepage>(); }
protected void Page_Load(object sender, EventArgs e) { var context = new SitecoreContext(); Model = context.GetHomeItem<MenuItem>(); }
protected void Page_Load(object sender, EventArgs e) { var context = new SitecoreContext(); lit1.Text = context.Database.Name; }
public static SitecoreContext GetFromHttpContext(string contextName = null) { if (string.IsNullOrEmpty(contextName)) { contextName = GetContextFromSite(); } var cachedContexts = CachedContexts; if (cachedContexts == null) { return new SitecoreContext(contextName); } else { SitecoreContext context = null; if (cachedContexts.ContainsKey(contextName)) { context = cachedContexts[contextName]; } if (context == null) { context = new SitecoreContext(contextName); cachedContexts[contextName] = context; } return context; } }
private void Page_Load(object sender, EventArgs e) { var context = new SitecoreContext(); Model = context.GetCurrentItem<BoxFeatures>(); }
private void Page_Load(object sender, EventArgs e) { var context = new SitecoreContext(); Model = context.GetHomeItem<NavBar>(); }
public ActionResult ContactUs() { var context = new SitecoreContext(); ContactUsModel=context.GetCurrentItem<ContactUs>(); return View("~/Views/Content/ContactUs.cshtml",ContactUsModel); }