public ActionResult FinancialLoanEdit(FormCollection form) { if (!string.IsNullOrEmpty(Session["username"] as string)) { try { List <FinancialLoan> lst = new List <FinancialLoan>(); for (int i = 1; i <= 10; i++) { FinancialLoan obj = new FinancialLoan(); obj.date = form["date"]; obj.Lender = form["Lender" + i]; obj.Loanbalance = form["Loanbalance" + i]; obj.Rate = form["Rate" + i]; obj.Term = form["Term" + i]; obj.Expiryterm = form["Expiryterm" + i]; obj.Phase = string.Empty; lst.Add(obj); } FinanacialLoanDataMonthly ld = new FinanacialLoanDataMonthly(); ld.UpdateFinancialLoan(lst); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("Error", ex)); } } else { return(RedirectToAction("Index", "Login")); } }
public List <FinancialLoan> GetFinancialLoanData() { List <FinancialLoan> lst = new List <FinancialLoan>(); DataSet data = DBConnection.GetData("GetMonthlyFinancialLoan"); foreach (DataRow row in data.Tables[0].Rows) { FinancialLoan obj = new FinancialLoan(); obj.LoanId = new Guid(row["LoanId"].ToString()); obj.Phase = !String.IsNullOrEmpty(row["Phase"].ToString()) ? row["Phase"].ToString() : string.Empty; obj.Lender = !String.IsNullOrEmpty(row["Lender"].ToString()) ? row["Lender"].ToString() : string.Empty; obj.Loanbalance = !String.IsNullOrEmpty(row["Loanbalance"].ToString()) ? row["Loanbalance"].ToString() : string.Empty; obj.Rate = !String.IsNullOrEmpty(row["Rate"].ToString()) ? row["Rate"].ToString() : string.Empty; obj.Term = !String.IsNullOrEmpty(row["Term"].ToString()) ? row["Term"].ToString() : string.Empty; obj.Expiryterm = !String.IsNullOrEmpty(row["Expiryterm"].ToString()) ? row["Expiryterm"].ToString() : string.Empty; obj.date = !String.IsNullOrEmpty(row["date"].ToString()) ? row["date"].ToString() : string.Empty; lst.Add(obj); } return(lst); }