コード例 #1
0
ファイル: AuthManager.cs プロジェクト: oknncelik/Example
        public async Task <IResult> Register(RegisterModel register)
        {
            HashHelpers.CreatePasswordHash(register.Password, out var passwordHash, out var passwordSalt);
            var user = new User
            {
                UserName     = register.UserName,
                EMail        = register.EMail,
                FirstName    = register.FirstName,
                LastName     = register.LastName,
                PasswordHash = passwordHash,
                PasswordSalt = passwordSalt,
                ActiveFlg    = true
            };

            user = await _userRepository.Add(user);

            var result = new UserInfoModel
            {
                Id        = user.Id,
                EMail     = user.EMail,
                UserName  = user.UserName,
                FirstName = user.FirstName,
                LastName  = user.LastName
            };

            return(new SuccessResult <UserInfoModel>(result, Messages.UserRegistered));
        }