public ActionResult Banners() { TreeNode FoundNode = DocumentQueryHelper.GetNodeByAliasPath(HttpContext.Request.Url.AbsolutePath); if (FoundNode != null) { SetContext(FoundNode.DocumentID); // Get Banners ExampleBannersViewModel Model = new ExampleBannersViewModel(); Model.BannerNameUrlsList = new List <ExampleBannersBanner>(); foreach (TreeNode Banner in DocumentQueryHelper.RepeaterQuery(ClassNames: "Demo.Banner", RelationshipName: "Banners", RelationshipWithNodeGuid: FoundNode.NodeGUID)) { Model.BannerNameUrlsList.Add(new ExampleBannersBanner() { BannerName = Banner.GetValue <string>("BannerName", ""), BannerUrl = Banner.GetValue <string>("BannerImage", "") }); } return(View(Model)); } else { return(HttpNotFound("Could not find page by that Url")); } }
public ActionResult Banners() { ITreeNode FoundNode = _exampleService.GetCurrentNode(); if (FoundNode != null) { SetContext(FoundNode.DocumentID); // Get Banners ExampleBannersViewModel Model = new ExampleBannersViewModel(); Model.BannerNameUrlsList = _exampleService.GetBannersFromNode(FoundNode); return(View(Model)); } else { return(HttpNotFound("Could not find page by that Url")); } }