コード例 #1
0
        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));
        }
コード例 #2
0
        public async Task <Customer> GetAsync(long id)
        {
            var spec = new CustomerFilterSpecification(id: id);

            return(await _customerRepository.SingleAsync(spec));
        }