private void AddDefaultContent(Entities.Page page) { var pageDefinitionStore = new PageDefinitionStore(Context.FileSystem); var contentComponent = new ContentComponent(Context); var definition = pageDefinitionStore.FindAll(x => x.Name == page.Template).FirstOrDefault(); if (definition == null) definition = CreateDefinition(pageDefinitionStore, page.Template); foreach (var content in definition.Items) { contentComponent.SaveContentTree(page, content, null); } }
private void AddDefaultContent(Entities.Page page) { var pageDefinitionStore = new PageDefinitionStore(Context.FileSystem); var contentComponent = new ContentComponent(Context); var definition = pageDefinitionStore.FindAll(x => x.Name == page.Template).FirstOrDefault(); if (definition == null) { definition = CreateDefinition(pageDefinitionStore, page.Template); } foreach (var content in definition.Items) { contentComponent.SaveContentTree(page, content, null); } }
private PageDefinition CreateDefinition(PageDefinitionStore pageDefinitionStore, string name) { var def = new PageDefinition(); def.Name = name; var container = new ContentItem { Name = "container", Type = "container"}; var row = new ContentItem { Name = "row1", Type = "row" }; var column = new ContentItem { Name = "col-1", Type = "column" }; row.Items.Add(column); container.Items.Add(row); def.Items.Add(container); pageDefinitionStore.Add(def); return def; }
private PageDefinition CreateDefinition(PageDefinitionStore pageDefinitionStore, string name) { var def = new PageDefinition(); def.Name = name; var container = new ContentItem { Name = "container", Type = "container" }; var row = new ContentItem { Name = "row1", Type = "row" }; var column = new ContentItem { Name = "col-1", Type = "column" }; row.Items.Add(column); container.Items.Add(row); def.Items.Add(container); pageDefinitionStore.Add(def); return(def); }