public JsonResult GetTransactionsList(Models.Biz.Withdraw.WithdrawSearchCondition condition) { var q = (from u in CurrentDb.Transactions where u.UserId == condition.UserId select new { u.Id, u.Sn, u.CreateTime, u.ChangeAmount, u.Balance, u.Type }); int total = q.Count(); int pageIndex = condition.PageIndex; int pageSize = condition.PageSize; q = q.OrderByDescending(r => r.CreateTime).Skip(pageSize * (pageIndex)).Take(pageSize); var list = q.ToList(); List <object> rList = new List <object>(); foreach (var item in list) { rList.Add(new { Id = item.Id, Sn = item.Sn, CreateTime = item.CreateTime, ChangeAmount = item.ChangeAmount.ToPrice(), Balance = item.Balance.ToPrice(), Type = item.Type.GetCnName() }); } PageEntity pageEntity = new PageEntity { PageSize = pageSize, TotalRecord = total, Rows = rList }; return(Json(ResultType.Success, pageEntity, "")); }
public JsonResult GetWithdrawList(Models.Biz.Withdraw.WithdrawSearchCondition condition) { var query = (from m in CurrentDb.Withdraw join u in CurrentDb.Merchant on m.MerchantId equals u.Id where m.UserId == condition.UserId select new { m.Id, m.Sn, u.ClientCode, m.Amount, m.AmountByAfterFee, m.Fee, m.SettlementStartTime, m.Status, m.CreateTime }); int pageIndex = condition.PageIndex; int pageSize = 10; query = query.OrderByDescending(r => r.CreateTime).Skip(pageSize * (pageIndex)).Take(pageSize); int total = query.Count(); List <object> olist = new List <object>(); foreach (var item in query) { olist.Add(new { item.Id, item.Sn, item.ClientCode, Amount = item.Amount.ToPrice(), AmountByAfterFee = item.AmountByAfterFee.ToPrice(), Fee = item.Fee.ToPrice(), Status = item.Status.GetCnName(), item.SettlementStartTime }); } PageEntity pageEntity = new PageEntity { PageSize = pageSize, TotalRecord = total, Rows = olist }; return(Json(ResultType.Success, pageEntity, "")); }