public ActionResult Create(string button, string[] payeeId, string[] sharedPercent, [Bind(Include = "Name,LoanAmount,InterestRate,FirstPaymentDate,Additional,Escrow,Term,InterestCompound,PaymentInterestRate,IsShared")] Loan loan) { ViewBag.Action = "Create"; ViewBag.Calculate = false; if (ModelState.IsValid) { loan.BasePayment = loan.CalculateMonthlyPayment(); loan.User = db.Users.Find(user.Id); if (button == "Save") { db.Loans.Add(loan); UpdateLoanShared(loan, payeeId, sharedPercent); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Calculate = true; loan = loan.Populate(user); } ViewBag.Users = GetAvailableUsers(); ViewBag.SharedPercentage = Enum.GetValues(typeof(SharedPercentage)); return(View("Details", loan)); }