Esempio n. 1
0
 private Comment GetCommentFromEntity(ForumSocialComment forumSocialComment, Func <string, string> imageToUrlConvertionHandler)
 {
     return(new Comment()
     {
         ID = forumSocialComment.ID,
         AttendeeId = forumSocialComment.Attende.ID,
         FirstName = forumSocialComment.Attende.FirstName,
         LastName = forumSocialComment.Attende.Lastname,
         CommentDesc = forumSocialComment.Comment,
         CommentedON = forumSocialComment.CommentedON,
         Userpic = imageToUrlConvertionHandler(forumSocialComment.Attende.Thumbnail)
     });
 }
Esempio n. 2
0
        public async Task <bool> PostComment(int userid, int postid, string comment, int?parentCommentID)
        {
            try
            {
                var eventID           = Db.SocialForums.Find(postid)?.EventID ?? throw new NullReferenceException("Event ID is not available");
                ForumSocialComment sc = new ForumSocialComment
                {
                    PostID          = postid,
                    Comment         = comment,
                    AttendesID      = userid,
                    CommentedON     = DateTime.Now,
                    ParentCommentID = parentCommentID
                };
                Db.ForumSocialComments.Add(sc);
                Db.SaveChanges();
                await NotifyOnCommentToEligible(parentCommentID, postid, eventID, "Replied to your Comment", comment, userid);

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
 private TreeNode <Comment> GenerateCommentHierarchy(TreeNode <Comment> treeNode, ForumSocialComment forumSocialComment, Func <string, string> imageToUrlConvertionHandler)
 {
     foreach (var comment in forumSocialComment.ForumSocialComments1)
     {
         TreeNode <Comment> childTree = treeNode.AddChild(GetCommentFromEntity(comment, imageToUrlConvertionHandler));
         GenerateCommentHierarchy(childTree, comment, imageToUrlConvertionHandler);
     }
     return(treeNode);
 }