Esempio n. 1
0
        public void Handle(DeleteArticleCommand command)
        {
            var article = _articleRepository.Load(command.ArticleId);

            Guard.IsNotNull(article, "找不到文章");
            if (article.User.Id != command.UserId)
            {
                throw new PowerException("非法操作");
            }
            var part = new  Dictionary <string, object>();

            part.Add("@ArticleId", command.ArticleId);
            _articleMessageRepository.ExecuteProcedure("Cotide_DeleteArticle", part);
        }
Esempio n. 2
0
        public void Handle(DeleteArticleMessageCommand command)
        {
            var articleMessage = _articleMessageRepository.Get(command.ArticleMessageId);

            Guard.IsNotNull(articleMessage, "articleMessage");

            if (articleMessage.Article.User.Id != command.UserId)
            {
                throw new BusinessException("不允许删除其他用户的留言信息");
            }
            var part = new  Dictionary <string, object> {
                { "@ArticleMessageID", command.ArticleMessageId }
            };

            _articleMessageRepository.ExecuteProcedure("Cotide_DeleteArticleMessage", part);
        }