Ejemplo n.º 1
0
        public Comment AddComment(int id, string message, string userId)
        {
            _articleRepository.DetachAllEntities();

            var article = _articleRepository.GetById(id);

            var user = userId == null ? null : _userService.GetById(userId);

            var comment = new Comment()
            {
                Article = article,
                User = user,
                Message = message,
                UpdatedDateTime = DateTime.UtcNow
            };

            article.Comments.Add(comment);

            UpdateArticle(article);

            return comment;
        }
Ejemplo n.º 2
0
 public void UpdateComment(Comment comment)
 {
     _commentRepository.Update(comment);
     SaveComment();
 }