public Search <ShelfLocationDto> Search( string queryParams = "", int limit = Configurations.DefaultLimit, int page = Configurations.DefaultPageValue, string sortColumn = Configurations.DefaultOrder, bool descending = false, bool count = false) { var query = _shelfLocationRepository.Table; var searchParams = EnsureSearchQueryIsValid(queryParams, ResolveSearchQuery); if (searchParams != null) { query = query.HandleSearchParams(searchParams); } query = query.GetQuery(sortColumn, @descending); var _ = new SearchWrapper <ShelfLocationDto, ShelfLocation>(); return(count ? _.ToCount(query) : _.ToList(query, page, limit, list => list.Select(entity => entity.ToDto()).ToList() as IList <ShelfLocationDto>)); }
public async Task <Search <T> > Search( string queryParams = "", int limit = Configurations.DefaultLimit, int page = Configurations.DefaultPageValue, string sortColumn = Configurations.DefaultOrder, bool descending = false, bool count = false) { var repo = _worker.GetRepositoryAsync <E>(); var query = await repo.GetQueryableAsync(searchFunc : src => src.SearchFunc(queryParams), queryExp : src => src.GetQuery(sortColumn, @descending), disableTracking : typeof(E).InitTracker(_lazyLoadEntities)); var search = new SearchWrapper <T, E>(); return(count ? search.ToCount(query) : search.ToList(query, page, limit, list => list.Select(entity => entity.ToDto <T, E>()).ToList())); }