Пример #1
0
        public ActionResult SaveUpdateLoan(LoanDuePayment ldp)
        {
            var loanDue = _context.LoanDuePayments.SingleOrDefault(c => c.Id == ldp.Id);

            loanDue.OR             = ldp.OR;
            loanDue.TotalAmountDue = ldp.TotalAmountDue;
            loanDue.IsPaid         = true;
            loanDue.PenaltyAmount  = ldp.PenaltyAmount;

            var loan = _context.Loans.SingleOrDefault(c => c.Id == loanDue.LoanId);

            loan.LoanTotalPayment = loan.LoanTotalPayment + ldp.TotalAmountDue;

            /*  public ActionResult Update(LayAwayTransactionReceipt layAway)
             *   {
             *    var transact = _context.LayAwayTransactions.SingleOrDefault(c => c.Id == layAway.LayAwayTransactionId);
             *     transact.TotalPaidAmount = transact.TotalPaidAmount + layAway.AmountPaid;
             *     _context.LayAwayTransactionReceipts.Add(layAway);
             *                          _context.SaveChanges();
             *                          return View();
             *                                      }*/



            var DueDate = new LoanDuePayment();

            DueDate.LoanId = loanDue.LoanId;
            if (loan.ModeOfPaymentId == 1)
            {
                DueDate.DueDateTime    = DateTime.Today.AddDays(1);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            if (loan.ModeOfPaymentId == 2)
            {
                DueDate.DueDateTime    = DateTime.Today.AddDays(7);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            if (loan.ModeOfPaymentId == 3)
            {
                DueDate.DueDateTime    = DateTime.Today.AddDays(14);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            if (loan.ModeOfPaymentId == 4)
            {
                DueDate.DueDateTime    = DateTime.Today.AddMonths(1);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            _context.LoanDuePayments.Add(DueDate);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult CreateTrackDuePayment(LoanDuePayment ldp)
        {
            var loanDue = _context.LoanDuePayments.SingleOrDefault(c => c.Id == ldp.Id);

            loanDue.OR = ldp.OR;

            var loan = _context.Loans.SingleOrDefault(c => c.Id == loanDue.LoanId);

            var DueDate = new LoanDuePayment();

            DueDate.LoanId = loanDue.LoanId;
            if (loan.ModeOfPaymentId == 1)
            {
                DueDate.DueDateTime    = DateTime.Today.AddDays(1);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            if (loan.ModeOfPaymentId == 2)
            {
                DueDate.DueDateTime    = DateTime.Today.AddDays(7);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            if (loan.ModeOfPaymentId == 3)
            {
                DueDate.DueDateTime    = DateTime.Today.AddDays(14);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            if (loan.ModeOfPaymentId == 4)
            {
                DueDate.DueDateTime    = DateTime.Today.AddMonths(1);
                DueDate.TotalAmountDue = loan.DuePayment;
                DueDate.LoanId         = loan.Id;
            }

            _context.LoanDuePayments.Add(DueDate);
            _context.SaveChanges();
            return(RedirectToAction("Details", new { loan.Id }));
        }
Пример #3
0
        public ActionResult Approve(string id)
        {
            var transact = _context.Loans.SingleOrDefault(c => c.Id == id);

            transact.LoanStatusId = 2;

            var downPayment = new LoanDuePayment();

            downPayment.LoanId         = id;
            downPayment.DueDateTime    = DateTime.Now;
            downPayment.PenaltyAmount  = 0;
            downPayment.TotalAmountDue = transact.Downpayment;
            downPayment.IsPaid         = true;
            _context.LoanDuePayments.Add(downPayment);
            _context.SaveChanges();

            var loandue = _context.LoanDuePayments.SingleOrDefault(c => c.LoanId == id);

            return(View(loandue));
        }