public bool CreateCommentFromPost(int contentId, DisqusPost post) { var posts = this.services.ContentManager.Query <DisqusPostMappingPart, DisqusPostMappingRecord>().Where(p => p.PostId == post.Id); var success = false; if (posts.Count() == 0) { var ctx = new CreateCommentContext() { Author = post.Author.Name, CommentText = post.Message, CommentedOn = contentId, Email = post.Author.Email, SiteName = post.Author.Url, }; var commentPart = this.commentService.CreateComment(ctx, false); commentPart.Record.CommentDateUtc = post.CreatedAt; commentPart.Record.Status = CommentStatus.Approved; this.postMappingRepository.Create(new DisqusPostMappingRecord { PostId = post.Id, ContentItemRecord = commentPart.ContentItem.Record }); success = true; } return(success); }
public bool CreateCommentFromPost(int contentId, DisqusPost post) { var posts = _orchardServices.ContentManager .Query <DisqusPostMappingPart, DisqusPostMappingRecord>() .Where(p => p.PostId == post.Id); if (posts.Count() > 0) { return(false); } var context = new CreateCommentContext { Author = post.Author.Name, CommentText = post.Message, CommentedOn = contentId, Email = post.Author.Email, SiteName = post.Author.Url, }; var commentPart = _commentService.CreateComment(context, false); commentPart.Record.CommentDateUtc = post.CreatedAt; commentPart.Record.Status = CommentStatus.Approved; var record = new DisqusPostMappingRecord { PostId = post.Id, ContentItemRecord = commentPart.ContentItem.Record }; _postMappingRepository.Create(record); return(true); }
public bool CreateCommentFromPost(int contentId, DisqusPost post) { var posts = this.services.ContentManager.Query<DisqusPostMappingPart, DisqusPostMappingRecord>().Where(p => p.PostId == post.Id); var success = false; if (posts.Count() == 0) { var ctx = new CreateCommentContext() { Author = post.Author.Name, CommentText = post.Message, CommentedOn = contentId, Email = post.Author.Email, SiteName = post.Author.Url, }; var commentPart = this.commentService.CreateComment(ctx, false); commentPart.Record.CommentDateUtc = post.CreatedAt; commentPart.Record.Status = CommentStatus.Approved; this.postMappingRepository.Create(new DisqusPostMappingRecord { PostId = post.Id, ContentItemRecord = commentPart.ContentItem.Record }); success = true; } return success; }