public ActionResult Login(member model) { using (var context = new EverestDvdEntities()) { bool isValid = context.member.Any(x => x.email_address == model.email_address && x.password == model.password); if (isValid) { FormsAuthentication.SetAuthCookie(model.email_address, false); IEnumerable <string> emp = from mem in context.member join role in context.roles on mem.role_Id equals role.id where mem.email_address == model.email_address select role.role; foreach (string output in emp) { if (output == "Manager") { return(RedirectToAction("ManagerHome", "Home")); } else if (output == "Assistant") { return(RedirectToAction("AssistantHome", "Home")); } else { return(RedirectToAction("Index", "Home")); } } } ModelState.AddModelError("", "Invalid email or password"); return(View()); } }