示例#1
0
        public PartialViewResult List(ConsumeRecordListRequest request)
        {
            var consumeRecordList = consumeRecordService.GetConsumeRecordList(request);
            var viewModel         = Mapper.Map <ConsumeRecordListModel>(request);

            viewModel.ConsumeRecordList = consumeRecordList;
            return(PartialView(viewModel));
        }
示例#2
0
        public IPagedList <ConsumeRecordEntity> GetConsumeRecordList([FromUri] ConsumeRecordListRequest request)
        {
            var consumeRecords           = consumeRecordService.GetConsumeRecordList(request);
            var consumeRecordList        = consumeRecords.ToList();
            var convertConsumeRecordList = Mapper.Map <List <ConsumeRecordEntity> >(consumeRecordList);

            return(new PagedList <ConsumeRecordEntity>(convertConsumeRecordList, request.PageIndex, request.PageSize, consumeRecords.TotalItemCount));
        }
        /// <summary>
        /// Get customer consume records
        /// </summary>
        /// <param name="customerID"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IPagedList <ConsumeRecord> GetConsumeRecordList(ConsumeRecordListRequest request)
        {
            IQueryable <ConsumeRecord> query = dbSet;

            query = query.WhereIf(request.CustomerID.HasValue, q => q.CustomerID == request.CustomerID);
            query = query.WhereIf(!string.IsNullOrEmpty(request.UserNo), q => q.Customer.UserNo.Contains(request.UserNo));
            query = query.WhereIf(!string.IsNullOrEmpty(request.Name), q => q.Customer.Name.Contains(request.Name));
            query = query.WhereIf(request.StartDate.HasValue, q => q.InDate >= request.StartDate);
            query = query.WhereIf(request.EndDate.HasValue, q => q.InDate <= request.EndDate);
            query = query.OrderByDescending(q => q.InDate);
            return(new PagedList <ConsumeRecord>(query, request.PageIndex, request.PageSize));
        }
示例#4
0
 public IPagedList <ConsumeRecord> GetConsumeRecordList(ConsumeRecordListRequest request)
 {
     return(consumeRecordRepository.GetConsumeRecordList(request));
 }
示例#5
0
 public IPagedList <ConsumeRecord> GetConsumeRecordList(ConsumeRecordListRequest request)
 {
     return(consumeRecordService.GetConsumeRecordList(request));
 }