Heyyy :)
I am searching for a solution a few hours ago, but i dont find some... so I hope, you can help me :) I get a Database with 2 different table, the first is teacher and the second is student. The programm should controll at the logIn the email- adresses and should knew, if the person is a teacher or a student. If I only work with one table, my function starts, but if I activated both, it didnĀ“t debbug :( I post my Code, which shows mistakes and I hope you can help me :)
public ActionResult LogOn(UserViewModel model) {
if (string.IsNullOrEmpty(model.EMail) || string.IsNullOrEmpty(model.Password)) return View();
//Have I to do a JOIN??
Teacher teacher = NHibernateSession.QueryOver<Teacher>().Where(x => x.EMail == model.EMail).List().ToList().First(); Student student = NHibernateSession.QueryOver<Student>().Where(x => x.EMail == model.EMail).List().ToList().First();
if (model.EMail == student.EMail && model.Password == student.Password) { FormsAuthentication.SetAuthCookie(model.EMail, false); return RedirectToAction("Index", "Student"); }
regrads, Elma
|