예제 #1
0
        public DeleteCommentViewModel Execute(DeleteCommentInputModel inputModel)
        {
            var comment = _database.Query <Comment>()
                          .FirstOrDefault(x => x.Id == inputModel.Id);

            if (comment != null)
            {
                _database.Decrement <Article>(comment.ArticleUri, x => x.CommentsCount);
                _database.Delete(comment);
            }

            return(new DeleteCommentViewModel());
        }