public ActionResult Login(LoginModel loginModel) { int _userId = _loginBusiness.verifyUser(loginModel.UserName, loginModel.UserPassword); if (ModelState.IsValid && _userId != -1) { FormsAuthentication.SetAuthCookie(loginModel.UserName, true); Session["UserId"] = _userId; return(Redirect("~/Main/MainPage")); } else { ModelState.AddModelError("", "Kullanıcı Adı yada Parola Hatalı !"); } return(View(loginModel)); }