//create loanpayment public loanpayment createLoanPayment(int id, double payment, double interest, double fine, DateTime payDate) { loanpayment lp = new loanpayment(); lp.LoanId = id; lp.AmountPaid = payment; lp.Interest = interest; lp.Fine = fine; lp.PayDate = payDate; return(lp); }
// insert payment to db public String insertLoanPayment(loanpayment lp) { DateTime sched; var s = (from c in wvac.loans where c.id == lp.LoanId select new { c.SchedDate }); sched = Convert.ToDateTime(s.First().SchedDate); wvac.loanpayments.Add(lp); wvac.SaveChanges(); return("Payment successful.\nSchedule for your next payment: " + sched); }