public ActionResult Login(User user) { if (String.IsNullOrEmpty(user.Email) || String.IsNullOrEmpty(user.Password)) { return(RedirectToAction("Login")); } string password = PublicFunction.HashPassword(user.Password); user.Password = PublicFunction.HashPassword(password); string loginStatus = db.Login(user); if (loginStatus == "Success" && db.IsAdmin(user)) { Session["AdminUser"] = user; return(RedirectToAction("Index", "Management")); } return(RedirectToAction("Login")); }