public Aluno AutenticarAluno(string Nome, string Senha) { SistemaBasico001Entities db = new SistemaBasico001Entities(); Aluno aluno_ = new Aluno(); alunos aluno = null; if (int.TryParse(Senha, out int i)) { aluno = db.alunos.Find(Convert.ToInt32(Senha)); } if (aluno != null) { if ((Nome == aluno.Nome && Senha == Convert.ToString(aluno.Matricula)) || Nome == aluno.Email && Senha == Convert.ToString(aluno.Matricula)) { aluno_.Nome = Nome; aluno_.Senha = Senha; aluno_.NA = 1; aluno_.id = aluno.IDAluno; return(aluno_); } return(null); } return(null); }
public Professor AutenticarProfessor(string Nome, string Senha) { Professor professor_ = new Professor(); SistemaBasico001Entities db = new SistemaBasico001Entities(); professores professor = db.professores.Find(Senha); if (professor != null) { if (Nome == professor.Nome && Senha == professor.Senha || Nome == professor.Email && Senha == professor.Senha) { professor_.Nome = Nome; professor_.Senha = Senha; professor_.NA = 2; return(professor_); } else { return(null); } } return(null); }