public Comment(string commentText, User creator) { CreatedTime = DateTime.UtcNow; LastUpdatedTime = DateTime.UtcNow; User = creator; Text = CustomHtmlHelpers.Linkify(commentText); }
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)); }