Ejemplo n.º 1
0
        public ActionResult AddFund(FormCollection f)
        {
            string   username = (string)Session["username"];
            double   amount   = Convert.ToDouble(f["amount"]);
            string   type     = f["type"];
            DateTime date     = Convert.ToDateTime(f["date"]);
            Payment  p        = new Payment(amount, username, date, type);

            if (PaymentDAO.InsertPayment(p) > 0)
            {
                Borrower b          = BorrowerDAO.GetBorrowerByUsername(username);
                double   NewDeposit = amount + b.Deposit;
                BorrowerDAO.UpdateDeposit(username, NewDeposit);
                ViewBag.message = "Payment Successfully !";
            }
            else
            {
                ViewBag.message = "Failed !!";
            }
            return(View());
        }