Exemplo n.º 1
0
        public Entities.Page GetPage(Entities.Page root, string value)
        {
            var component = new PageComponent(Context);
            var content = new ContentComponent(Context);
            var page = component.GetPage(root, value);
            page.Contents = content.GetPageContent(page);

            return page;
        }
Exemplo n.º 2
0
        public List<ContentModel> GetContent(string url)
        {
            var contentComponent = new ContentComponent(Context);
            var pageService = new PageService(Context);
            var page = pageService.GetPage(Context.Root, url);
            var content = contentComponent.GetPageContent(page);

            var contentModels = content.Select(x => ContentModel(x)).ToList();

            return contentModels;
        }
Exemplo n.º 3
0
        public Entities.Site GetSite()
        {
            var component = new SiteComponent(Context);
            var contentComponent = new ContentComponent(Context);
            var site = component.GetSite();

            var contents = contentComponent.GetSiteContent(site);

            site.Contents = contents;

            return site;
        }
Exemplo n.º 4
0
        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);
            }

        }
Exemplo n.º 5
0
        public void AddToPage(string url, List<ContentModel> model)
        {
            var contentComponent = new ContentComponent(Context);
            var pageComponent = new PageService(Context);

            var page = pageComponent.GetPage(Context.Root, url);

            if (page == null)
            {
                throw new Exception("Page does not exist!");
            }

            contentComponent.DeleteContent(page);

            foreach (var content in model)
            {
                var contentTree = GetContentTreeFromModel(content);

                contentComponent.AddContent(page, contentTree);
            }
        }
Exemplo n.º 6
0
 public void AddContentToPage(Entities.Page page, Entities.Content content)
 {
     var component = new ContentComponent(Context);
     component.AddContent(page, content);
 }