public ActionResult Setup(SetupModel setupModel) { return View(setupModel); }
public ActionResult CreateAdminAccount(SetupModel setupModel) { if (!sqlMembership.HasAdminAccount()) { if (setupModel.Password != setupModel.RepeatPassword) { ModelState.AddModelError("Password", "Passwords must match"); ModelState.AddModelError("RepeatPassword", "Passwords must match"); return RedirectToAction("Setup", new{setupModel}); } var user = sqlMembership.CreateAccount(setupModel.Name, setupModel.Email, setupModel.Username, setupModel.Password); sqlRoleProvider.AddUserToRoles(user, "Admin", "Moderator"); } sqlAuthSettings.SqlAuthenticationEnabled = true; settingsProvider.SaveSettings(sqlAuthSettings); formsAuthenticator.Logout(); return RedirectToAction("Index"); }
public ActionResult Setup() { var setupModel = new SetupModel { HasAdminAccount = sqlMembership.HasAdminAccount() }; return View(setupModel); }