Пример #1
0
        public IEnumerable <TemplateType> Templates(string siteId)
        {
            var templateTypes = templateProvider.LoadTemplateTypes();
            var query         = pageTemplateProvider.GetTemplates(siteId);

            var ts = HierarchyHelper.Build <PageTemplate, TemplateType>(query.Where(o => o.ParentTemplateName == null),
                                                                        o => new TemplateType
            {
                Name       = o.TemplateName,
                Path       = o.TemplatePath,
                ParentName = o.ParentTemplateName,
                Sections   = templateTypes.First(t => t.Path.ToLower() == o.TemplatePath.ToLower()).Sections
            }, o => query.Where(q => q.ParentTemplateName == o.TemplateName), (p, c) => { p.Children.Add(c); });

            return(ts);
        }
Пример #2
0
 public IEnumerable <PageTemplate> Templates(string siteId, string parentName = null)
 {
     return(pageProvider.GetTemplates(siteId, parentName));
 }