public bool UpdateCurrentStudenNotes(decimal note1, decimal note2, decimal note3, decimal note4, int currentId, ref string error) { bool Isupdate = false; decimal TopeCorte = 1.25M; try { using (NotasAcademicasEntities context = new NotasAcademicasEntities()) { DetalleNotas detalleNotas = context.DetalleNotas.SingleOrDefault(e => e.IdDetalleNotas == currentId); if (detalleNotas != null) { detalleNotas.Nota1 = note1; detalleNotas.Nota2 = note2; detalleNotas.Nota3 = note3; detalleNotas.Nota4 = note4; detalleNotas.TotalNota = ((note1 * TopeCorte) / 5) + (note2 * TopeCorte) / 5 + (note3 * TopeCorte) / 5 + (note4 * TopeCorte) / 5; context.SaveChanges(); return(true); } return(Isupdate); } } catch (System.Exception ex) { error = ex.ToString(); return(Isupdate); } }
public bool UpdateCurrentUser(int idUser, string typeUser, string celular, string email, string facultad, string grado, string profesion, string idioma, string password, ref string error) { bool Isupdate = false; try { using (NotasAcademicasEntities context = new NotasAcademicasEntities()) { if (typeUser.Equals("student")) { Estudiante estudiante = context.Estudiante.SingleOrDefault(e => e.IdEstudiante == idUser); if (estudiante != null) { estudiante.Telefono = celular; estudiante.Email = email; estudiante.Clave = password; context.SaveChanges(); return(true); } return(Isupdate); } else { Profesor profesor = context.Profesor.SingleOrDefault(e => e.IdProfesor == idUser); if (profesor != null) { profesor.Telefono = celular; profesor.Email = email; profesor.Facultad = facultad; profesor.TituloProfesional = profesion; profesor.GradoEscolaridad = grado; profesor.Idiomas = idioma; profesor.Clave = password; context.SaveChanges(); return(true); } return(Isupdate); } } } catch (System.Exception ex) { error = ex.ToString(); return(Isupdate); } }