public ActionResult EnglilushRegister(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user MembershipCreateStatus createStatus; Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus); if (createStatus == MembershipCreateStatus.Success) { FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false); return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", ErrorCodeToString(createStatus)); } } // If we got this far, something failed, redisplay form return View(model); }
public void regAll() { AccountController a = new AccountController(); //var counslers = MobileApplication.DAL.ApplicationContext.Instnace.contextInstance.counslers.ToList(); //foreach (var item in counslers) //{ // RegisterModel reg = new RegisterModel() // { // Email = item.email_1, // UserName = item.usernmae, // Password = "******", // ConfirmPassword = "******" // }; // a.EnglilushRegister(reg); //} RegisterModel reg = new RegisterModel() { Email = "*****@*****.**", UserName = "******", Password = "******", ConfirmPassword = "******" }; a.EnglilushRegister(reg); }