Пример #1
0
        public ActionResult DetallePago(int id)
        {
            dbHeredadesEntities db   = new dbHeredadesEntities();
            tbPagoDeudor        pago = db.tbPagoDeudor.Find(id);

            return(View(pago));
        }
Пример #2
0
        public ActionResult Pagar(int codDeudor, decimal pago)
        {
            dbHeredadesEntities db      = new dbHeredadesEntities();
            tbPagoDeudor        debitar = new tbPagoDeudor
            {
                codDeudor  = codDeudor,
                codUsuario = Sesion.ObtenerCodigo(),
                pago       = pago,
                fecha      = DateTime.Now
            };

            db.tbPagoDeudor.Add(debitar);
            tbDeudor deudor = db.tbDeudor.Find(codDeudor);

            deudor.deuda -= pago;
            tbCaja caja = db.tbCaja.Find(1);

            caja.cantidad += pago;
            db.SaveChanges();
            return(RedirectToAction("Pagos", new { id = codDeudor }));
        }