Esempio n. 1
0
        public ActionResult Edit(int id)
        {
            EditBorrowViewModel ebvm = new EditBorrowViewModel();
            BorrowBusinessLayer bbl  = new BorrowBusinessLayer();

            Borrow b = bbl.GetBorrow(id);

            ebvm.BorrowID        = b.BorrowID;
            ebvm.BTitle          = b.BTitle;
            ebvm.BTotal          = b.BTotal;
            ebvm.BMonthShouldPay = b.BMonthShouldPay;
            ebvm.BNextRepay      = b.BNextRepay.ToShortDateString();
            ebvm.BShouldPay      = b.BShouldPay;
            ebvm.BHavePay        = b.BHavePay;
            ebvm.BRemark         = b.BRemark;

            return(View("Edit", ebvm));
        }
Esempio n. 2
0
        // 还款
        public ActionResult SetBorrowState(int id)
        {
            BorrowBusinessLayer bbl = new BorrowBusinessLayer();
            Borrow b = new Borrow();

            b = bbl.GetBorrow(id);
            if (b.BFinish == false)
            {
                b.BHavePay += 1;
                if (b.BHavePay == b.BShouldPay)
                {
                    b.BFinish = true;
                }
                else
                {
                    b.BNextRepay = b.BNextRepay.AddMonths(1);
                }
                bbl.ChangeItemState(b);
            }
            return(RedirectToAction("Borrow"));
        }