public UnifyResponseDto DeleteClassify(Guid id) { Classify classify = _classifyRepository.Select.Where(a => a.Id == id).ToOne(); if (classify.CreateUserId != _currentUser.Id) { throw new LinCmsException("您无权删除他人的分类专栏"); } _classifyRepository.Delete(new Classify { Id = id }); return(UnifyResponseDto.Success()); }
public UnifyResponseDto DeleteTag(Guid id) { _tagRepository.Delete(new Tag { Id = id }); return(UnifyResponseDto.Success()); }
public UnifyResponseDto DeletePoem(long id) { _poemRepository.Delete(new LinPoem { Id = id }); return(UnifyResponseDto.Success()); }
public UnifyResponseDto Delete(Guid id) { _classifyRepository.Delete(new Classify { Id = id }); return(UnifyResponseDto.Success()); }
public void Delete(long subscribeUserId) { bool any = _userSubscribeRepository.Select.Any(r => r.CreateUserId == _currentUser.Id && r.SubscribeUserId == subscribeUserId); if (!any) { throw new LinCmsException("已取消关注"); } _userSubscribeRepository.Delete(r => r.SubscribeUserId == subscribeUserId && r.CreateUserId == _currentUser.Id); }
public void Delete(Guid tagId) { bool any = _userTagRepository.Select.Any(r => r.CreateUserId == _currentUser.Id && r.TagId == tagId); if (!any) { throw new LinCmsException("已取消关注"); } _userTagRepository.Delete(r => r.TagId == tagId && r.CreateUserId == _currentUser.Id); _tagService.UpdateSubscribersCount(tagId, -1); }
public async Task UpdateTagAsync(Guid id, CreateUpdateArticleDto updateArticleDto) { List <Guid> tagIds = await _tagArticleRepository.Select.Where(r => r.ArticleId == id).ToListAsync(r => r.TagId); tagIds.ForEach(async(tagId) => { await _tagService.UpdateArticleCountAsync(tagId, -1); }); _tagArticleRepository.Delete(r => r.ArticleId == id); List <TagArticle> tagArticles = new List <TagArticle>(); updateArticleDto.TagIds.ForEach(async(tagId) => { tagArticles.Add(new TagArticle() { ArticleId = id, TagId = tagId }); await _tagService.UpdateArticleCountAsync(tagId, 1); }); await _tagArticleRepository.InsertAsync(tagArticles); }