public ActionResult Login(ViewLogin login) { if (function.CookieID() != null) { return(Redirect("/")); } if (ModelState.IsValid) { int status = usersDAO.LoginAdmin(login.Email, login.Password); switch (status) { case 1: var user = db.Users.FirstOrDefault(t => t.user_email == login.Email && t.user_pass == login.Password); HttpCookie cookie = new HttpCookie("admin_id", user.user_id.ToString()); cookie.Expires.AddDays(10); Response.Cookies.Set(cookie); return(RedirectToAction("Index", "HomeAdmin")); case -1: TempData["noti_login"] = "******"; break; case -2: TempData["noti_login"] = "******"; break; case -3: TempData["noti_login"] = "******"; break; default: TempData["noti_login"] = "******"; break; } } return(View(login)); }