예제 #1
0
        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;
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
 public bool Register(RegisterModel model)
 {
     userManager.InsertUser(model);
     return Login(model.Login);
 }
예제 #4
0
 public ActionResult Register()
 {
     var model = new RegisterModel();
     return View(model);
 }