Beispiel #1
0
        public async Task <ObjectResult> CreateUser([FromBody] RegisterUserViewModel user)
        {
            ApplicationUser applicationUser = new ApplicationUser
            {
                UserName       = user.UserName,
                Email          = user.Email,
                EmailConfirmed = true,
            };

            return(await _accountManagement.CreateUser(applicationUser, user.Password));
        }
Beispiel #2
0
        public async Task <OperationResult> CreateAsync(User user)
        {
            var appUser = await _accountManagement.GetUserByEmailAsync(user.Email);

            if (appUser == null)
            {
                appUser = new ApplicationUser {
                    Email = user.Email, UserName = user.Email, Name = user.Name
                };
                await _accountManagement.CreateUser(appUser, user.Password);

                return(new OperationResult(true, "You have been successfully registered!", ""));
            }
            return(new OperationResult(false, "User with this email already exist!", ""));
        }