public void InsertComment(Comment comment) { Article article = context.Articles.Find(comment.ArticleId); UserProfile commenter = context.Users.Find(comment.UserId); comment.Content = WhiteSpaceHelper.CompactWhitespaces(comment.Content); context.Comments.Add(comment); article.Comments.Add(comment); article.RepPoints += 1; context.Entry(article).State = EntityState.Modified; Save(); }
public void UpdateComment(Comment comment, string content) { comment.Content = WhiteSpaceHelper.CompactWhitespaces(content); context.Entry(comment).State = EntityState.Modified; Save(); }