public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user var createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email); if (createStatus == MembershipCreateStatus.Success) { return RedirectToAction("LogOn", "Account"); } ModelState.AddModelError("", ErrorCodeToString(createStatus)); } // If we got this far, something failed, redisplay form return View(model); }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user var createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email); if (createStatus == MembershipCreateStatus.Success) { FormsService.SignIn(model.UserName, false /* createPersistentCookie */); return RedirectToAction("Index", "Home"); } ModelState.AddModelError("", ErrorCodeToString(createStatus)); } // If we got this far, something failed, redisplay form return View(model); }