コード例 #1
0
        private void AddOutlinesForLinks(IEnumerable<CategoryLink> links, List<OutlineItem> parents, OutlineItem lastItem, string allowedCatalogId, ICollection<Outline> outlines)
        {
            foreach (var link in links)
            {
                if (IsAllowedCatalog(link.CatalogId, allowedCatalogId))
                {
                    var outline = CreateOutline(link.CatalogId);

                    if (link.CategoryId != null)
                    {
                        var category = GetCategoryItem(link.CategoryId, true);
                        outline.Items.AddRange(category.Parents.Select(ConvertToOutlineItem));
                        outline.Items.Add(ConvertToOutlineItem(category));
                    }

                    if (parents != null)
                    {
                        outline.Items.AddRange(parents);
                    }

                    outline.Items.Add(lastItem);
                    outlines.Add(outline);
                }
            }
        }
コード例 #2
0
        public static moduleModel.Outline ToWebModel(this moduleModel.Outline outline)
        {
            var result = new moduleModel.Outline();

            result.Items = new List <moduleModel.OutlineItem>();
            foreach (var outlineItem in outline.Items)
            {
                var newOutlineItem = new moduleModel.OutlineItem();
                newOutlineItem.Id = outlineItem.Id;
                newOutlineItem.HasVirtualParent = outlineItem.HasVirtualParent;
                newOutlineItem.SeoObjectType    = outlineItem.SeoObjectType;
                if (outlineItem.SeoInfos != null)
                {
                    newOutlineItem.SeoInfos = outlineItem.SeoInfos.Select(x => new SeoInfo {
                        IsActive = x.IsActive, LanguageCode = x.LanguageCode, SemanticUrl = x.SemanticUrl, StoreId = x.StoreId
                    }).ToList();
                }
                result.Items.Add(newOutlineItem);
            }
            return(result);
        }
コード例 #3
0
 private static OutlineItem Clone(OutlineItem item)
 {
     return item == null ? null : new OutlineItem
     {
         Id = item.Id,
         SeoObjectType = item.SeoObjectType,
     };
 }