public GetShopCashTransfersResponse ShopCashTransfers([FromBody] ShopCashTransfersRequest request) { request.CheckNotNull(nameof(request)); //获取数据 int pageSize = 10; var cashTransfers = _walletQueryService.GetShopCashTransfers(request.WalletId); var total = cashTransfers.Count(); if (request.Type != ShopCashTransferType.All) { cashTransfers = cashTransfers.Where(x => x.Type == request.Type); } total = cashTransfers.Count(); //分页 cashTransfers = cashTransfers.OrderByDescending(x => x.CreatedOn).Skip(pageSize * (request.Page - 1)).Take(pageSize); return(new GetShopCashTransfersResponse { Total = total, ShopCashTransfers = cashTransfers.Select(x => new ShopCashTransfer { Number = x.Number, Amount = x.Amount, Fee = x.Fee, FinallyValue = x.FinallyValue, Remark = x.Remark, CreatedOn = x.CreatedOn.ToShortDateString(), Type = x.Type.ToDescription(), Direction = x.Direction.ToDescription(), Status = x.Status.ToDescription() }).ToList() }); }
public GetShopCashTransfersResponse ShopCashTransfers(ShopCashTransfersRequest request) { request.CheckNotNull(nameof(request)); var currentAccount = _contextService.GetCurrentAccount(HttpContext.Current); //获取数据 int pageSize = 10; var shopCashTransfers = _walletQueryService.GetShopCashTransfers(currentAccount.WalletId.ToGuid()).Where(x => x.Status == ShopCashTransferStatus.Success); var total = shopCashTransfers.Count(); //通过以上方法 已经获取_wallet实例了 if (request.Type != ShopCashTransferType.All) { shopCashTransfers = shopCashTransfers.Where(x => x.Type == request.Type); } total = shopCashTransfers.Count(); //分页 shopCashTransfers = shopCashTransfers.OrderByDescending(x => x.CreatedOn).Skip(pageSize * (request.Page - 1)).Take(pageSize); return(new GetShopCashTransfersResponse { Total = total, ShopCashTransfers = shopCashTransfers.Select(x => new ShopCashTransfer { Number = x.Number, Amount = x.Amount, Fee = x.Fee, FinallyValue = x.FinallyValue, Remark = x.Remark, CreatedOn = x.CreatedOn.ToShortDateString(), Type = x.Type.ToDescription(), Direction = x.Direction.ToDescription() }).ToList() }); }