Пример #1
0
        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));
        }