public ActionResult Login(string email, string password) { foreach (var user in db.Users.ToList()) { if (user.Email == email && user.Password == password) { Auth.SetUserId(user.UserId); Auth.SetRole((int)Auth.Roles.LibraryUser); break; } } foreach (var user in db.Employees.ToList()) { if (user.Email == email && user.Password == password) { Auth.SetRole((int)Auth.Roles.LibraryWorker); break; } } foreach (var user in db.Publishers.ToList()) { if (user.Email == email && user.Password == password) { Auth.SetUserId(user.PublisherId); Auth.SetRole((int)Auth.Roles.Publisher); break; } } return(RedirectToAction("index", "Home")); }
public ActionResult Logout() { Auth.SetRole((int)Auth.Roles.NotLoggedIn); Auth.SetUserId(0); return(RedirectToAction("Login")); }