示例#1
0
        // TODO: Can use IEnumerable here
        static void UpdateContentItem(ContentItem contentItem, NewsEntryInfo newsEntry, List <Term> terms, List <IFileInfo> images)
        {
            // update content item after EntryId get its value
            // TODO: ContentKey should allow users to view your content item directly based on links provided from the tag search results
            // more info here: http://www.dnnsoftware.com/community-blog/cid/131963/adding-core-taxonomy-to-your-module-part-2-ndash-content-items
            contentItem.ContentKey = newsEntry.EntryId.ToString();
            NewsDataProvider.Instance.ContentController.UpdateContentItem(contentItem);

            // add images to content item
            if (images.Count > 0)
            {
                var attachmentController = new AttachmentController(NewsDataProvider.Instance.ContentController);
                attachmentController.AddImagesToContent(contentItem.ContentItemId, images);
            }

            // add terms to content item
            var termController = new TermController();

            foreach (var term in terms)
            {
                termController.AddTermToContent(term, contentItem);
            }
        }