Ejemplo n.º 1
0
        private EntryContentBase GetParent(CatalogContentBase content)
        {
            ILinksRepository linksRepository = ServiceLocator.Current.GetInstance <ILinksRepository>();
            IContentLoader   contentLoader   = ServiceLocator.Current.GetInstance <IContentLoader>();

            IEnumerable <Relation> parentRelations = linksRepository.GetRelationsByTarget(content.ContentLink);

            if (parentRelations.Any())
            {
                Relation firstRelation = parentRelations.FirstOrDefault();
                if (firstRelation != null)
                {
                    var parentProductContent = contentLoader.Get <EntryContentBase>(firstRelation.Source);
                    return(parentProductContent);
                }
            }
            return(null);
        }