public SelectLogin_Result Login(string Email, string Password) { SelectLogin_Result loginResult = new SelectLogin_Result(); try { using (var context = new DBEntities()) { return(loginResult = context.SelectLogin(Email, Password).FirstOrDefault()); } } catch (SqlException ex) { Console.WriteLine(ex); throw; } }
public JsonResult ValidateUserToLogin(string username, string password) { SelectLogin_Result result = loginData.Login(username, password); if (result.Role == "Professor") { return(Json(loginData.GetProfessor(result.Person_id), JsonRequestBehavior.AllowGet)); } else if (result.Role == "Student") { return(Json(loginData.GetStudent(result.Person_id), JsonRequestBehavior.AllowGet)); } return(null); }