Exemple #1
0
        public ContentItem GetOrCreate(string familyKey, string key, string url)
        {
            var container = containerRepository.GetOrCreateBelowStart((ei) =>
            {
                ei.Visible     = false;
                ei.TemplateKey = ExternalItem.ContainerTemplateKey;
                ei.Title       = ExternalItem.ExternalContainerName;
                ei.Name        = ExternalItem.ExternalContainerName;
            });
            var familyContainer = containerRepository.GetOrCreate(container, (ei) =>
            {
                ei.Visible     = false;
                ei.TemplateKey = ExternalItem.ContainerTemplateKey;
                ei.Title       = familyKey;
                ei.Name        = familyKey;
                ei.ZoneName    = ExternalItem.ExternalContainerName;
            });

            if (string.IsNullOrEmpty(key))
            {
                key = ExternalItem.SingleItemKey;
            }

            var item = familyContainer.Children.FindNamed(key)
                       ?? Create(familyKey, key, url, familyContainer);

            return(item);
        }