コード例 #1
0
        public static void CreateBlogPostComment(Guid blogPostId, GenericPostComment comment)
        {
            BlogPost blogPost = SFBlogsManager.GetBlogPost(blogPostId);

            var cs        = SystemManager.GetCommentsService();
            var language  = Thread.CurrentThread.CurrentUICulture.Name;
            var threadKey = ControlUtilities.GetLocalizedKey(blogPostId, language);

            var commentAuthor = new AuthorProxy(comment.Author, comment.AuthorEmail);

            EnsureBlogPostThreadExists(threadKey, commentAuthor, blogPost.Title, SFBlogsManager, language, cs);

            var commentProxy = new CommentProxy(comment.Content, threadKey, commentAuthor, comment.AuthorIP);

            commentProxy.Status = StatusConstants.Published;

            var newComment = cs.CreateComment(commentProxy);

            newComment.DateCreated  = comment.CommentDateGMT;
            newComment.LastModified = comment.CommentDateGMT;

            cs.UpdateComment(newComment);
        }
コード例 #2
0
        public static void CreateBlogPostComment(Guid blogPostId, GenericPostComment comment)
        {
            BlogPost blogPost = SFBlogsManager.GetBlogPost(blogPostId);

            var cs = SystemManager.GetCommentsService();
            var language = Thread.CurrentThread.CurrentUICulture.Name;
            var threadKey = ControlUtilities.GetLocalizedKey(blogPostId, language);

            var commentAuthor = new AuthorProxy(comment.Author, comment.AuthorEmail);

            EnsureBlogPostThreadExists(threadKey, commentAuthor, blogPost.Title, SFBlogsManager, language, cs);

            var commentProxy = new CommentProxy(comment.Content, threadKey, commentAuthor, comment.AuthorIP);

            commentProxy.Status = StatusConstants.Published;

            var newComment = cs.CreateComment(commentProxy);

            newComment.DateCreated = comment.CommentDateGMT;
            newComment.LastModified = comment.CommentDateGMT;

            cs.UpdateComment(newComment);
        }