public async Task <ActionResult> Create([Bind(Include = "ClienteID,Nombre,Apellido,Telefono,Correo")] Cliente cliente)
        {
            if (ModelState.IsValid)
            {
                db.cliente.Add(cliente);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(cliente));
        }
        public async Task <ActionResult> Create([Bind(Include = "PrestamoID,Plazo,Interes,CantidadPrestada,IdCliente")] Prestamos prestamos)
        {
            if (ModelState.IsValid)
            {
                db.Prestamos.Add(prestamos);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(prestamos));
        }
Beispiel #3
0
        public async Task <ActionResult> Create([Bind(Include = "PrestamoID,Plazo,Interes,CantidadPrestada,Cuota,IniciodePrestamo,IdCliente")] Prestar prestar)
        {
            if (ModelState.IsValid)
            {
                double cantidadPagar = 0d;
                double interes       = 0d;
                double cuota         = 0d;

                cantidadPagar = prestar.CantidadPrestada / (prestar.Plazo * 12);
                interes       = (prestar.CantidadPrestada * prestar.Interes / 100) / 12;
                cuota         = cantidadPagar + interes;

                prestar.Cuota = cuota;


                db.prestar.Add(prestar);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(prestar));
        }