public ActionResult Create() { GenerateCreateVariables(); var x = new LoanTransactions(); x.Cheques.Add(new ChequeViewModel()); return View(x); }
public JsonResult AddChequeInfo(LoanTransactions loan) { var id = WebSecurity.GetUserId(User.Identity.Name); var x = _manager.SaveLoan(loan, id); //var details = _manager.GetClientDetails(loan.ClientId); //var duration = _manager.DurationValue(loan.DurationId); //Helper.Helper.SendLoanCreatedMail(details, "LoanCreated", loan.Cheques[0].Amount, loan.Cheques[0].DateDue, duration); return Json(x); }
private void UpdateLoan(LoanTransactions loan) { var x = _db.LoanTransactions.Find(loan.LoanId); x.Duration = loan.Duration; x.TotalAmount = loan.TotalAmount; x.LoanIdForCore = loan.LoanIdForCore; _db.SaveChanges(); }
private int CraeteLoan(LoanTransactions loan, int adminId) { var x = new LoanTransaction() { DateCreated = DateTime.Now, ClientId = loan.ClientId, DurationId = loan.DurationId, TotalAmount = loan.TotalAmount, AdminId = adminId, LoanIdForCore = loan.LoanIdForCore }; _db.LoanTransactions.Add(x); _db.SaveChanges(); return x.LoanId; }
public LoanTransactions SaveLoan(LoanTransactions loan, int adminId) { loan.LoanId = CraeteLoan(loan, adminId); //create a function to check if this is null if (loan.Guarantee != null) { loan.Guarantee.GuarantorId = CreateGurantor(loan.LoanId, loan.Guarantee); } foreach (var cheque in loan.Cheques.Where(cheque => !cheque.IsDelete)) { cheque.ChequeId = SaveCheque(cheque, loan.LoanId); } return loan; }
public object EditLoan(LoanTransactions loan) { UpdateLoan(loan); if (IsNullOrEmpty(loan.Guarantee)) { loan.Guarantee.GuarantorId = UpdateGurantor(loan.Guarantee); } foreach (var cheque in loan.Cheques) { if (cheque.IsDelete && cheque.ChequeId != 0) { RemoveCheque(cheque.ChequeId); } if (!cheque.IsDelete && cheque.ChequeId != 0) { EditCheque(cheque); } if (cheque.IsDelete || cheque.ChequeId != 0) continue; cheque.ChequeId = SaveCheque(cheque, loan.LoanId); } return loan; }
public JsonResult EditChequeInfo(LoanTransactions loan) { var x = _manager.EditLoan(loan); return Json(x); }