예제 #1
0
        internal void Build(SettingsModule settings, List <ContentItem> items)
        {
            List <DomainViewModel>        list      = new List <DomainViewModel>();
            List <DomainPathMapViewModel> additions = new List <DomainPathMapViewModel>();

            foreach (var domain in settings.Settings.Domains)
            {
                var item = Items.FirstOrDefault(p => p.Id.Equals(domain.Id, StringComparison.OrdinalIgnoreCase));
                if (item == null)
                {
                    item = new DomainPathMapViewModel(new DomainPathMap()
                    {
                        Id      = domain.Id,
                        Display = domain.Name,
                        Slug    = domain.Name.ToLower(),
                        Path    = domain.Name.ToLower(),
                        Items   = new List <PathNode>().Default()
                    });
                    additions.Add(item);
                }
                list.Add(new DomainViewModel(domain, item));
            }
            additions.ForEach(x => { Items.Add(x); });
            Build(items);
            settings.Initialize(list);
        }
 public DomainViewModel(Domain model, DomainPathMapViewModel item) : this(model)
 {
     Item = item;
 }