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