public ActionResult LogOn(User model, string returnUrl) { if (ModelState.IsValid) { if (membershipService().ValidateUser(model.UserName, model.Password)) { formsService().SignIn(model.UserName, false); if (!String.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Members"); } } else { ModelState.AddModelError("", "Please try again"); } } return View(model); }
public ActionResult Register(User model) { if (ModelState.IsValid) { var repo = userRepository(); repo.Insert(model); if(repo.Commit()) { formsService().SignIn(model.UserName, false); return RedirectToAction("Index", "Home"); } } return View(model); }
public ActionResult LogOn() { var u = new User(); return View(u); }