public ActionResult Login(Models.Users user, string returnUrl) { if (ModelState.IsValid) { if (user.IsValid(user.UserID, user.Password)) { FormsAuthentication.SetAuthCookie(user.UserID, false); return(Redirect(returnUrl)); } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } return(View(user)); }
public ActionResult Login(Models.Users user) { if (ModelState.IsValid) { if (user.IsValid(user.UserName, user.Password)) { FormsAuthentication.SetAuthCookie(user.UserName.ToString(), user.RememberMe); return(RedirectToAction("Index", "Home")); } else { ModelState.AddModelError("", "Login data is incorrect!"); } } return(View(user)); }