public async Task <IPagedResult <Customer> > ListAsync(int pageIndex, int pageSize, string term = null, long?userId = null) { var filterSpecification = new CustomerFilterSpecification( userId: userId, term: term ); var filterPaginatedSpecification = new CustomerFilterPaginatedSpecification(pageIndex * pageSize, pageSize, userId: userId, term: term ); var items = await _customerRepository.ListAsync(filterPaginatedSpecification); var totalItems = await _customerRepository.CountAsync(filterSpecification); return(new PagedResult <Customer>(pageIndex, pageSize, totalItems, items)); }
public async Task <Customer> GetAsync(long id) { var spec = new CustomerFilterSpecification(id: id); return(await _customerRepository.SingleAsync(spec)); }