public ActionResult Login([Bind(Include = "Username,Password")] string username, string password) { if (administratorRepository.Login(username, Configuration.Encryption(password)).IsSuccessStatusCode) { Session["Username"] = username; Session["UserID"] = administratorRepository.ReadByUsername(username).PersonalCode; Session["AccessLevel"] = "Administrator"; return(RedirectToAction("Index", "Admin")); } else if (guardRepository.Login(username, Configuration.Encryption(password)).IsSuccessStatusCode) { Session["Username"] = username; Session["UserID"] = guardRepository.ReadByUsername(username).PersonalCode; Session["AccessLevel"] = "Guard"; return(RedirectToAction("Index", "Guard")); } else if (residentRepository.Login(username, Configuration.Encryption(password)).IsSuccessStatusCode) { Session["Username"] = username; Session["UserID"] = residentRepository.ReadByUsername(username).PersonalCode; Session["AccessLevel"] = "Resident"; return(RedirectToAction("Index", "Resident")); } else { return(RedirectToAction("LoginForm")); //nepaejo prisijungti vairantas } }