| | |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<List<WmsStore>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsStore> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | public async Task<List<WmsStore>> GetListAsync(WmsStore? store, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsStore> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsStoreSpecification(); |
| | | return await (await GetDbSetAsync()) |
| | |
| | | .Where(specification.ToExpression()) |
| | | .Where(x => !x.IsDeleted) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.StoreCode.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(store.StoreCode),u=>u.StoreCode.Contains(store.StoreCode)) |
| | | .WhereIf(!string.IsNullOrEmpty(store.StoreName),u=>u.StoreName.Contains(store.StoreName)) |
| | | .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsStore.Sort) : sorting) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<long> GetCountAsync(string filter = null, Specification<WmsStore> specification = null, CancellationToken cancellationToken = default) |
| | | public async Task<long> GetCountAsync(WmsStore? store, string filter = null, Specification<WmsStore> specification = null, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsStoreSpecification(); |
| | | return await (await GetQueryableAsync()) |
| | | .Where(specification.ToExpression()) |
| | | .Where(x => !x.IsDeleted) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.StoreCode.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(store.StoreCode), u => u.StoreCode.Contains(store.StoreCode)) |
| | | .WhereIf(!string.IsNullOrEmpty(store.StoreName), u => u.StoreName.Contains(store.StoreName)) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |
| | | |