Exemplo n.º 1
0
 public Comment(string commentText, User creator)
 {
     CreatedTime     = DateTime.UtcNow;
     LastUpdatedTime = DateTime.UtcNow;
     User            = creator;
     Text            = CustomHtmlHelpers.Linkify(commentText);
 }
Exemplo n.º 2
0
        public ActionResult PostReply(int id, string text)
        {
            var comment = db.Comments.First(x => x.CommentId == id);

            // Convert URLs in the text to links if they're not already a link.
            text = CustomHtmlHelpers.Linkify(text);

            Comment newComment = new Comment()
            {
                Text        = text,
                CreatedTime = DateTime.Now
            };

            comment.Comments.Add(newComment);
            db.SaveChanges();

            return(PartialView("_comment", newComment));
        }