Example #1
0
        public async Task <User> Register(User user, string password)
        {
            //Infrastracture.Infsture.CreatePasswordHash(UserForRegisterDto.Username,out byte[]passwordHash,out byte[]passwordSalt);
            UserAuthorization.CreatePasswordHash(password, out var passwordSalt, out var passwordHash);
            user.PasswordSalt = passwordSalt;
            user.PasswordHash = passwordHash;
            await _context.Users.AddAsync(user);

            await _context.SaveChangesAsync();

            return(user);
        }