Exemplo n.º 1
0
        public DeleteArticleViewModel Execute(DeleteArticleInputModel inputModel)
        {
            _database.Delete <Article>(inputModel.Id);

            _database.Query <Comment>()
            .Where(x => x.ArticleUri == inputModel.Id)
            .Each(x => _database.Delete(x));

            return(new DeleteArticleViewModel());
        }
Exemplo n.º 2
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());
        }