public ResponseModel Guardar() { var rm = new ResponseModel(); try { using (var ctx = new TetsContext()) { if (this.id > 0) { ctx.Entry(this).State = EntityState.Modified; } else { ctx.Entry(this).State = EntityState.Added; } rm.SetResponse(true); ctx.SaveChanges(); } } catch (Exception exception) { throw; } return(rm); }
public void Eliminar() { try { using (var ctx = new TetsContext()) { ctx.Entry(this).State = EntityState.Deleted; ctx.SaveChanges(); } } catch (Exception exception) { throw; } }