public async Task <ActionResult <Paginated <BoardGameReadDto> > > Search(BoardGameSearchDto dto) { var searchOptions = new SearchOptions { }; // === ORDER BY if (dto.OrderBy != null) { string orderBy = SearchUtils.GetOrderBy(dto.OrderBy); searchOptions.OrderBys.Add(orderBy); } // === ORDER BY // === FILTERS if (dto.Filters != null) { List <string> filtersWheres = SearchUtils.GetFiltersWheres(dto.Filters); searchOptions.Wheres.AddRange(filtersWheres); } // === FILTERS // === TEXTSEARCH if (dto.TextSearch != null) { List <string> fullTextWheres = SearchUtils.GetTextSearchWheres <BoardGameEntity>(dto.TextSearch); searchOptions.Wheres.AddRange(fullTextWheres); } // === TEXTSEARCH // === PAGINATION if (dto.Paginate != null) { searchOptions.TakeSkip = new TakeSkip(dto.Paginate); } // === PAGINATION var paginated = await _boardGamerepository.Search(searchOptions); var readDtos = _mapper.Map <List <BoardGameReadDto> >(paginated.Data); return(new Paginated <BoardGameReadDto>(readDtos, paginated.TotalItems)); }