Esempio n. 1
0
 public void eliminar(int pkAuto)
 {
     try
     {
         using (var ctx = new DataModel())
         {
             autos user = ctx.autos.Single(r => r.pkAuto == pkAuto);
             ctx.Entry(user).State = EntityState.Deleted;
             ctx.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
 public void guardar(autos nAuto, int pkAuto = 0)//Agregamos primero la funcion para guardar un nuevo cliente
 {
     try
     {
         using (var ctx = new DataModel())
         {
             if (nAuto.pkAuto > 0)
             {
                 ctx.Entry(nAuto).State = EntityState.Modified;
             }
             else
             {
                 nAuto.bStatus          = true;
                 ctx.Entry(nAuto).State = EntityState.Added;
             }
             ctx.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
 public void guardar(ventas nVentas, int pkVentas = 0)//Agregamos primero la funcion para guardar un nuevo cliente
 {
     try
     {
         using (var ctx = new DataModel())
         {
             autos    nautos    = new autos();
             clientes nclientes = new clientes();
             if (nVentas.pkVenta > 0)
             {
                 ctx.Entry(nVentas).State = EntityState.Modified;
             }
             else
             {
                 ctx.Entry(nVentas).State = EntityState.Added;
             }
             ctx.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }