示例#1
0
 public void guardar()
 {
     try
     {
         using (var db = new cnfModelo())
         {
             if (this.SOLcodigo > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 public void eliminar()
 {
     try
     {
         using (var db = new cnfModelo())
         {
             db.Entry(this).State = EntityState.Deleted;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }