Example #1
0
 public User(RegisterModel model)
 {
     this.UserName = model.UserName;
     this.FirstName = model.FirstName;
     this.LastName = model.LastName;
     this.Email = model.Email;
     this.faceStates = new HashSet<FaceState>();
 }
Example #2
0
        public static void AddNewRegisteredUser(RegisterModel registerModel)
        {
            using (UowData db = new UowData())
            {
                User newUser = new User(registerModel);

                db.Users.Add(newUser);
                db.SaveChanges();
            }
        }
Example #3
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                    WebSecurity.Login(model.UserName, model.Password);

                    UsersData.AddNewRegisteredUser(model);

                    return RedirectToAction("Index", "Home");
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }