private IQueryable <SpotConnectorInfo> GetFilteredQuery(GetSpotConnectorInfoInput input) { var query = QueryableExtensions.WhereIf(_spotConnectorInfoRepository.GetAll(), !input.Filter.IsNullOrWhiteSpace(), u => u.Name.Contains(input.Filter) || u.Code.Contains(input.Filter)); return(query); }
public async Task <PagedResultDto <SpotConnectorInfoListDto> > GetSpotConnectorInfo(GetSpotConnectorInfoInput input) { var query = GetFilteredQuery(input); var userCount = await query.CountAsync(); var spotConnectorInfos = await query .OrderBy(input.Sorting) .PageBy(input) .ToListAsync(); var spotConnectorInfosListDto = ObjectMapper.Map <List <SpotConnectorInfoListDto> >(spotConnectorInfos); return(new PagedResultDto <SpotConnectorInfoListDto>( userCount, spotConnectorInfosListDto )); }