コード例 #1
0
ファイル: UserManager.cs プロジェクト: nzhuravel/PhotoManager
        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);
 }