public async Task <ActionResult> SellList(SpotGoodsQueryRequest request) { if (!Request.IsAjaxRequest()) { return(View(request)); } var manager = new SpotGoodsManager(User); var paging = await manager.GetSpotGoodsOrderListAsync(request.Start, request.Take, request.GetSpotGoodsOrderListQueryFilter()); var spotGoodList = paging.List.Select(u => { var spotGoods = Mapper.Map <SpotGoodsOrder, SpotGoodsOrderViewModel>(u); return(spotGoods); }); return(Json(true, string.Empty, new { paging.Total, List = spotGoodList })); }
public async Task <IHttpActionResult> GetSpotGoodsOrders(string openId, LogisticType logisticType) { var manager = new SpotGoodsManager(); Func <IQueryable <SpotGoodsOrder>, IQueryable <SpotGoodsOrder> > filter = query => { query = query.Where(r => r.OpenId == openId); if (logisticType == LogisticType.Self) { query = query.Where(r => r.SpotGoods.Status == SpotGoodsStatus.PickBySelf || r.SpotGoods.Status == SpotGoodsStatus.HasTaken); } if (logisticType == LogisticType.SF) { query = query.Where(r => r.SpotGoods.Status == SpotGoodsStatus.SF || r.SpotGoods.Status == SpotGoodsStatus.HasSendGoods); } return(query); }; var result = await manager.GetSpotGoodsOrderListAsync(filter); var orders = result.Select(r => new SpotGoodListItemViewModel(r)).ToList(); return(Ok(orders)); }