作者:老岑
第一次尝试做项目,这是一个借贷系统。
我首先是把这个借贷系统的功能之类的想法先做一个模板出来,然后就拿来设置数据库,然后又要缕清表与表之间的关系,这是我的数据库表:
然后绑定数据库,再从数据里面把你每一个页面所需要的数据绑定起来
public ActionResult SlestBorrowMoney(LayuiTablePage layuiTablePage) { var
listStu = from tbBorrowMoney in myModels.B__BorrowMoney join tbKindType in
myModels.B__KindType on tbBorrowMoney.KindTypeID equals tbKindType.KindTypeID
join tbClinet in myModels.S_Client on tbBorrowMoney.ClientID equals
tbClinet.ClientID join tbUser in myModels.S_User on tbBorrowMoney.ClientID
equals tbUser.UserID join tbRepayment in myModels.B___Repayment on
tbBorrowMoney.RepaymentID equals tbRepayment.RepaymentID join tbPaymentMethod
in myModels.B___PaymentMethod on tbBorrowMoney.RepaymentID equals
tbPaymentMethod.PaymentMethodID orderby tbBorrowMoney.BorrowMoneyID descending
select new BorrowMoney { BorrowMoneyID = tbBorrowMoney.BorrowMoneyID,
KindTypeID = tbKindType.KindTypeID, ClientID = tbClinet.ClientID, RepaymentID =
tbRepayment.RepaymentID, UserID = tbUser.UserID,
PaymentMethodID=tbPaymentMethod.PaymentMethodID, Borrowing =
tbBorrowMoney.Borrowing, UserName = tbUser.UserName, BorrowingTitle =
tbBorrowMoney.BorrowingTitle, BorrowingBalance =
tbBorrowMoney.BorrowingBalance, RateInterest = tbBorrowMoney.RateInterest,
LifeLoan = tbBorrowMoney.LifeLoan, KindName = tbKindType.KindName,
PaymentMethodName = tbPaymentMethod.PaymentMethodName, SubmissionTime =
tbBorrowMoney.SubmissionTime.ToString(), AuditStatus =
tbBorrowMoney.AuditStatus }; var intTotalRow = listStu.Count();
List<BorrowMoney> list = listStu .Skip(layuiTablePage.GetStartIndex())
.Take(layuiTablePage.limit) .ToList(); //调用分页封装类 LayuiTableData<BorrowMoney>
layuiTableData = new LayuiTableData<BorrowMoney>(); layuiTableData.count =
intTotalRow;//行总数 layuiTableData.data = list;//具体显示数据 return
Json(layuiTableData, JsonRequestBehavior.AllowGet); }
就这样我就把第一个页面所需要的数据绑定好了…
待续。。。
热门工具 换一换