/// <summary> /// Creates the relationship for associated contents. /// </summary> /// <param name="content">Content which has to be updated.</param> /// <param name="contentDetails">Details of the content.</param> private static void CreateAssociateContents(Content content, ContentDetails contentDetails) { if (contentDetails.AssociatedFiles != null && contentDetails.AssociatedFiles.Count() > 0) { foreach (var dataDetails in contentDetails.AssociatedFiles) { // Create new associated file only if contentId is not set if (!dataDetails.ContentID.HasValue || dataDetails.ContentID.Value <= 0) { var associatedContent = new Content(); associatedContent.SetValuesFrom(contentDetails, dataDetails); // Note that Modifying user is the one who is creating the associated contents. associatedContent.CreatedByID = content.ModifiedByID.Value; var associatedRelation = new ContentRelation() { Content = content, Content1 = associatedContent, ContentRelationshipTypeID = (int)AssociatedContentRelationshipType.Associated }; content.ContentRelation.Add(associatedRelation); } } } }
/// <summary> /// Updates the relationship for video and content. /// </summary> /// <param name="content">Content which has to be updated.</param> /// <param name="contentDetails">Details of the content.</param> private static void CreateVideo(Content content, ContentDetails contentDetails) { if (contentDetails.Video != null) { var videoContent = new Content(); videoContent.SetValuesFrom(contentDetails, contentDetails.Video); // Note that Modifying user is the one who is creating the video. videoContent.CreatedByID = content.ModifiedByID.Value; var contentRelation = new ContentRelation() { Content = content, Content1 = videoContent, ContentRelationshipTypeID = (int)AssociatedContentRelationshipType.Video }; content.ContentRelation.Add(contentRelation); } }