Esempio n. 1
0
        public PageList <ReceiveDetailModel> SearchReceiveDetails(ReceiveDetailSearchCondition condition)
        {
            var query = _shoppingContext.ReceiveDetails.AsNoTracking().AsQueryable();

            if (condition.ReceiveId > 0)
            {
                query = query.Where(p => p.ReceiveId == condition.ReceiveId);
            }

            var receiveDetails = query.OrderBy(o => o.Id).Skip(condition.PageSize * condition.PageNumber)
                                 .Take(condition.PageSize).ToList();

            return(new PageList <ReceiveDetailModel>(Mapper.Map <List <ReceiveDetailModel> >(receiveDetails), query.Count()));
        }
Esempio n. 2
0
        public ActionResult ReceiveDetailList(DataSourceRequest command, ReceiveDetailSearchCondition condition)
        {
            condition.PageNumber = command.Page - 1;
            condition.PageSize   = command.PageSize;
            var receiveDetails = _receiveService.SearchReceiveDetails(condition);

            receiveDetails.DataSource.ForEach(x => CalculateAmount(x));
            var gridModel = new DataSourceResult
            {
                Data  = receiveDetails.DataSource,
                Total = receiveDetails.TotalItems
            };

            return(Json(gridModel));
        }