protected void Update(Curso entity) { using (var context = new AcademiaContext()) { if (isRepeated(entity)) { throw new Exception("Repeated entity"); } entity.Materia.Plan = null; var local = context.Set <Materia>() .Local .FirstOrDefault(f => f.ID == entity.Materia.ID); if (local != null) { context.Entry(local).State = EntityState.Detached; } context.Entry(entity.Materia).State = System.Data.Entity.EntityState.Unchanged; entity = context.Curso.Attach(entity); entity.Comision = context.Comision.Attach(entity.Comision); entity.Materia = context.Materia.Attach(entity.Materia); var entry = context.Entry(entity); // Gets the entry for entity inside context entry.State = EntityState.Modified; context.SaveChanges(); } }
protected void Update(Comision comi) { using (var context = new AcademiaContext()) { var comision = context.Comisiones.Find(comi.ID); context.Entry(comision).CurrentValues.SetValues(comi); context.SaveChanges(); } }
protected void Update(Plan plan) { using (var context = new AcademiaContext()) { var planEntity = context.Planes.Find(plan.ID); context.Entry(plan).CurrentValues.SetValues(plan); context.SaveChanges(); } }
protected void Update(Especialidad esp) { using (var context = new AcademiaContext()) { var especialidad = context.Especialidades.Find(esp.ID); context.Entry(especialidad).CurrentValues.SetValues(esp); context.SaveChanges(); } }
protected void Update(Persona psr) { using (var context = new AcademiaContext()) { var alumno = context.Personas.Find(psr.ID); context.Entry(alumno).CurrentValues.SetValues(psr); context.SaveChanges(); } }
protected void Update(Curso cur) { using (var context = new AcademiaContext()) { var curso = context.Cursos.Find(cur.ID); context.Entry(curso).CurrentValues.SetValues(cur); context.SaveChanges(); } }
protected void Update(Persona entity) { using (var context = new AcademiaContext()) { entity = context.Persona.Attach(entity); var entry = context.Entry(entity); // Gets the entry for entity inside context entry.State = EntityState.Modified; context.SaveChanges(); } }
protected void Update(Plan entity) { using (var context = new AcademiaContext()) { entity = context.Plan.Attach(entity); entity.Especialidad = context.Especialidad.Attach(entity.Especialidad); var entry = context.Entry(entity); // Gets the entry for entity inside context entry.State = EntityState.Modified; context.SaveChanges(); } }
protected void Update(DocenteCurso entity) { using (var context = new AcademiaContext()) { if (isRepeated(entity)) { throw new Exception("Repeated entity"); } entity = context.DocenteCurso.Attach(entity); entity.Docente = context.Persona.Attach(entity.Docente); entity.Curso = context.Curso.Attach(entity.Curso); var entry = context.Entry(entity); // Gets the entry for entity inside context entry.State = EntityState.Modified; context.SaveChanges(); } }