示例#1
0
        public async Task DeleteAsync(Guid id)
        {
            var tags = await GetTagsOfPost(id);

            _tagRepository.DecreaseUsageCountOfTags(tags.Select(t => t.Id).ToList());
            _postTagRepository.DeleteOfPost(id);
            _commentRepository.DeleteOfPost(id);

            await _postRepository.DeleteAsync(id);
        }
示例#2
0
        public async Task DeleteAsync(Guid id)
        {
            var post = await _postRepository.GetAsync(id);

            await AuthorizationService.CheckAsync(post, CommonOperations.Delete);

            var tags = await GetTagsOfPost(id);

            _tagRepository.DecreaseUsageCountOfTags(tags.Select(t => t.Id).ToList());
            _postTagRepository.DeleteOfPost(id);
            _commentRepository.DeleteOfPost(id);

            await _postRepository.DeleteAsync(id);
        }