public bool InsertUser(RegisterModel model) { using (dbContext = new UserManagerEntities()) { User user; if (model.UserRole == UserType.SuperUser) { user = new SuperUser(); } else { user = new UsualUser(); } user.Email = model.Email; user.Login = model.Login; user.Password = model.Password; user.FirstName = model.FirstName; user.LastName = model.LastName; dbContext.Users.AddObject(user); dbContext.SaveChanges(); return true; } }
public ActionResult Register(RegisterModel model) { if (ModelState.IsValid && !UserValidator.CheckUser(new LoginModel() { Login = model.Login, Password = model.Password })) { // Attempt to register the user try { accountManager.Register(model); return RedirectToAction("Index", "Home"); } catch (MembershipCreateUserException e) { throw new NotImplementedException(); } } // If we got this far, something failed, redisplay form return View(model); }
public bool Register(RegisterModel model) { userManager.InsertUser(model); return Login(model.Login); }
public ActionResult Register() { var model = new RegisterModel(); return View(model); }