Exemple #1
0
 public void eliminar()
 {
     try
     {
         using (var ctx = new tekusContext())
         {
             ctx.Entry(this).State = EntityState.Deleted;
             ctx.SaveChanges();
         }
     }
     catch (Exception E)
     {
         throw;
     }
 }
Exemple #2
0
        public void salvarCliente()
        {
            try
            {
                using (var ctx = new tekusContext())
                {
                    if (this.id > 0)
                    {
                        ctx.Entry(this).State = EntityState.Modified;
                    }
                    else
                    {
                        ctx.Entry(this).State = EntityState.Added;
                    }

                    ctx.SaveChanges();
                }
            }
            catch (Exception E)
            {
                throw;
            }
        }