public PagedResultDto <TagDto> Get([FromQuery] TagSearchDto searchDto) { List <TagDto> tags = _tagRepository.Select .WhereIf(searchDto.TagName.IsNotNullOrEmpty(), r => r.TagName.Contains(searchDto.TagName)) .OrderByDescending(r => r.Id) .ToPagerList(searchDto, out long totalCount) .Select(r => { TagDto tagDto = _mapper.Map <TagDto>(r); tagDto.ThumbnailDisplay = _currentUser.GetFileUrl(tagDto.Thumbnail); return(tagDto); }).ToList(); return(new PagedResultDto <TagDto>(tags, totalCount)); }
public PagedResultDto <TagDto> Get(TagSearchDto searchDto) { if (searchDto.Sort.IsNullOrEmpty()) { searchDto.Sort = "create_time desc"; } List <TagDto> tags = _tagRepository.Select .WhereIf(searchDto.TagIds.IsNotNullOrEmpty(), r => searchDto.TagIds.Contains(r.Id)) .WhereIf(searchDto.TagName.IsNotNullOrEmpty(), r => r.TagName.Contains(searchDto.TagName)) .WhereIf(searchDto.Status != null, r => r.Status == searchDto.Status) .OrderBy(searchDto.Sort) .ToPagerList(searchDto, out long totalCount) .Select(r => { TagDto tagDto = _mapper.Map <TagDto>(r); tagDto.ThumbnailDisplay = _currentUser.GetFileUrl(tagDto.Thumbnail); return(tagDto); }).ToList(); return(new PagedResultDto <TagDto>(tags, totalCount)); }
/// <summary> /// 根据状态得到标签列表 /// </summary> /// <param name="searchDto"></param> /// <returns></returns> public async Task <PagedResultDto <TagListDto> > GetListAsync(TagSearchDto searchDto) { if (searchDto.Sort.IsNullOrEmpty()) { searchDto.Sort = "create_time desc"; } List <TagListDto> tags = (await _tagRepository.Select.IncludeMany(r => r.UserTags, r => r.Where(u => u.CreateUserId == _currentUser.Id)) .WhereIf(searchDto.TagIds.IsNotNullOrEmpty(), r => searchDto.TagIds.Contains(r.Id)) .WhereIf(searchDto.TagName.IsNotNullOrEmpty(), r => r.TagName.Contains(searchDto.TagName)) .WhereIf(searchDto.Status != null, r => r.Status == searchDto.Status) .OrderBy(searchDto.Sort) .ToPagerListAsync(searchDto, out long totalCount)) .Select(r => { TagListDto tagDto = _mapper.Map <TagListDto>(r); tagDto.ThumbnailDisplay = _fileRepository.GetFileUrl(tagDto.Thumbnail); tagDto.IsSubscribe = r.UserTags.Any(); return(tagDto); }).ToList(); return(new PagedResultDto <TagListDto>(tags, totalCount)); }
public Task <PagedResultDto <TagListDto> > GetListAsync([FromQuery] TagSearchDto searchDto) { searchDto.Status = true; return(_tagService.GetListAsync(searchDto)); }
public Task <PagedResultDto <TagListDto> > GetAllAsync([FromQuery] TagSearchDto searchDto) { return(_tagService.GetListAsync(searchDto)); }
public PagedResultDto <TagDto> Get([FromQuery] TagSearchDto searchDto) { searchDto.Status = true; return(_tagService.Get(searchDto)); }
public PagedResultDto <TagDto> GetAll([FromQuery] TagSearchDto searchDto) { return(_tagService.Get(searchDto)); }
public async Task <ActionResult> Post([FromBody] TagSearchDto model) { var result = await this.recipeProvider.GetByTags(model.Tags); return(Ok(result)); }