Ejemplo n.º 1
0
        public async Task <ActionResult> ProcessRegister(string userName, string password, string email, string fullname, string phoneNumber)
        {
            var user = new User()
            {
                UserName    = userName,
                Email       = email,
                Name        = fullname,
                PhoneNumber = phoneNumber,
                CreatedAt   = DateTime.Now
            };
            // success
            IdentityResult result = await _userManager.CreateAsync(user, password);

            if (result.Succeeded)
            {
                _userManager.AddToRole(user.Id, "User");
                return(Redirect("/Home"));
            }
            return(Redirect("/Home"));
        }