public async Task <ActionResult> Create([Bind(Include = "Id,Nombre,Cedula,Correo,FechaIngreso")] CI cI) { if (ModelState.IsValid) { db.CI.Add(cI); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cI)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Monto,Interes,Plazo,Cuota,CIID,FechaInicioPrestamo")] PT pT) { if (ModelState.IsValid) { double cantidadPagar = 0d; double interes = 0d; double cuota = 0d; cantidadPagar = pT.Monto / (pT.Plazo * 12); interes = (pT.Monto * pT.Interes / 100) / 12; cuota = cantidadPagar + interes; pT.Cuota = cuota; db.PT.Add(pT); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CIID = new SelectList(db.CI, "Id", "Nombre", pT.CIID); return(View(pT)); }