public ActionResult Login(MVCDemo.Models.User model) { User user = DataAccess.IsValid(model.UserName, model.Password); if (user.UserName != null) { //FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); FormsAuthentication.SetAuthCookie(model.UserName, false); Session["UserName"] = user.UserName; Session["UserEmail"] = user.Email; return RedirectToAction("Home", "Home"); } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); return View(model); } }
public ActionResult SignUp(MVCDemo.Models.User model) { if (ModelState.IsValid) { if (DataAccess.CreateUser(model) == 1) { return RedirectToAction("Home", "Home"); } else { return View("Error"); } } else { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); return View(model); } }