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); }
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); }