Beispiel #1
0
        public string guardarEditar()
        {
            string respuesta = "";

            try
            {
                using (var context = new ModelGps()) {
                    if (this.idobservacion == 0)
                    {
                        context.Entry(this).State = EntityState.Added;
                        respuesta = "ingresado";
                    }
                    else
                    {
                        context.Entry(this).State = EntityState.Modified;
                        respuesta = "modificado";
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw;
            }
            return(respuesta);
        }
Beispiel #2
0
 public void guardarEditar()
 {
     try
     {
         using (var context = new ModelGps())
         {
             if (this.idcliente == 0)
             {
                 context.Entry(this).State = EntityState.Added;
             }
             else
             {
                 context.Entry(this).State = EntityState.Modified;
             }
             context.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
 public void eliminarVehiculo()
 {
     try
     {
         using (var context = new ModelGps())
         {
             context.Entry(this).State = EntityState.Deleted;
             context.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #4
0
        public void eliminarChip()
        {
            try
            {
                using (var context = new ModelGps())
                {
                    context.Entry(this).State = EntityState.Deleted;


                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }