public async Task <PagedResultDto <DepreciationListDto> > GetDepreciationsAsync(GetDepreciationInput input) { var query = _menuRepository.GetAll() .WhereIf(!input.Name.IsNullOrWhiteSpace(), m => m.Name.Contains(input.Name)); var totalCount = await query.CountAsync(); var items = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return(new PagedResultDto <DepreciationListDto>( totalCount, items.Select(item => ObjectMapper.Map <DepreciationListDto>(item)).ToList())); }
public async Task <PagedResultDto <DepreciationListDto> > GetDepreciationsAsync(GetDepreciationInput input) { IQueryable <Depreciation> query = _depreciationRepository.GetAll() .WhereIf(!input.Name.IsNullOrWhiteSpace(), m => m.Name.Contains(input.Name)); int totalCount = await query.CountAsync(); System.Collections.Generic.List <Depreciation> items = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return(new PagedResultDto <DepreciationListDto>( totalCount, items.Select(item => ObjectMapper.Map <DepreciationListDto>(item)).ToList())); }