//AGREGAR PAGOS DEL PRESTAMOS
        public void agregarPago(decimal credito, DateTime fechapago, long id, decimal total, decimal interes, decimal importe)
        {
            using (var bd = new Conexion())
            {
                pagos pagos = new pagos
                {
                    pag_credito   = credito,
                    pag_fechapago = fechapago,
                    pag_prestamo  = id,
                    pag_total     = total,
                    pag_interes   = interes,
                    pag_importe   = importe
                };

                long consulta = bd.pagos.LongCount();

                if (consulta == 0)
                {
                    bd.Database.ExecuteSqlCommand("ALTER TABLE pagos AUTO_INCREMENT=1");
                }
                else
                {
                    long maxVal = bd.pagos.Max(p => p.pag_id) + 1;

                    bd.Database.ExecuteSqlCommand("ALTER TABLE pagos AUTO_INCREMENT={0}", maxVal);
                }

                bd.pagos.Add(pagos);
                bd.SaveChanges();
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            pagos pagos = db.pagos.Find(id);

            db.pagos.Remove(pagos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id_pagos,id_part_jugador,id_part_equipo,total,fecha")] pagos pagos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pagos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_part_equipo  = new SelectList(db.Partido_Equipo, "id_part_equipo", "sancion", pagos.id_part_equipo);
     ViewBag.id_part_jugador = new SelectList(db.Partido_Jugador, "id_part_jugador", "Tarjeta", pagos.id_part_jugador);
     return(View(pagos));
 }
        // GET: Pagos/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            pagos pagos = db.pagos.Find(id);

            if (pagos == null)
            {
                return(HttpNotFound());
            }
            return(View(pagos));
        }
        // GET: Pagos/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            pagos pagos = db.pagos.Find(id);

            if (pagos == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id_part_equipo  = new SelectList(db.Partido_Equipo, "id_part_equipo", "sancion", pagos.id_part_equipo);
            ViewBag.id_part_jugador = new SelectList(db.Partido_Jugador, "id_part_jugador", "Tarjeta", pagos.id_part_jugador);
            return(View(pagos));
        }
	private void detach_pagos(pagos entity)
	{
		this.SendPropertyChanging();
		entity.Cliente = null;
	}
	private void attach_pagos(pagos entity)
	{
		this.SendPropertyChanging();
		entity.Cliente = this;
	}
 partial void Deletepagos(pagos instance);
 partial void Updatepagos(pagos instance);
 partial void Insertpagos(pagos instance);