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; } }
public void eliminar() { try { using (var db = new cnfModelo()) { db.Entry(this).State = EntityState.Deleted; db.SaveChanges(); } } catch (Exception ex) { throw ex; } }