private void bttnActualizar_Click(object sender, EventArgs e)
 {
     using (NotasEstudiantesEntities1 db = new NotasEstudiantesEntities1())
     {
         string Id  = dgvMateria.CurrentRow.Cells[0].Value.ToString();
         int    IdC = int.Parse(Id);
         Mate = db.materia.Where(VerificarId => VerificarId.id_materia == IdC).First();
         Mate.nombre_materia  = txtNombremateria.Text;
         db.Entry(Mate).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
示例#2
0
 private void bttnActualizar_Click(object sender, EventArgs e)
 {
     using (NotasEstudiantesEntities1 db = new NotasEstudiantesEntities1())
     {
         string Id  = dgvEstudiante.CurrentRow.Cells[0].Value.ToString();
         int    IdC = int.Parse(Id);
         Est = db.estudiante.Where(VerificarId => VerificarId.id_estudiante == IdC).First();
         Est.nombre_estudiante = txtNombreEstudiante.Text;
         Est.apellido          = txtApellido.Text;
         Est.usuario           = txtUsuario.Text;
         Est.contrasena        = txtContrasena.Text;
         db.Entry(Est).State   = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     using (NotasEstudiantesEntities1 db = new NotasEstudiantesEntities1())
     {
         string Id  = dgvNota.CurrentRow.Cells[0].Value.ToString();
         int    IdC = int.Parse(Id);
         Not = db.nota.Where(VerificarId => VerificarId.id_nota == IdC).First();
         Not.id_estudante    = int.Parse(txtIdestudiante.Text);
         Not.id_materia      = int.Parse(txtIdmateria.Text);
         Not.notas           = Convert.ToDouble(txtNota.Text);
         db.Entry(Not).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     cargardatos();
 }