public async Task <User> RegiserAsync(User user, string passoword)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHass(passoword, out passwordHash, out passwordSalt);
            user.PasswordHash = passwordHash;
            user.PasswordSalt = passwordSalt;

            await _context.Users.AddAsync(user);

            await _context.SaveChangesAsync();

            return(user);
        }
Exemple #2
0
        public async Task <user> Register(user u, string password)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            u.PasswordHash = passwordHash;
            u.PasswordSalt = passwordSalt;

            await _context.Users.AddAsync(u);

            await _context.SaveChangesAsync();

            return(u);
        }
 public async Task <bool> SaveAll()
 {
     return(await _context.SaveChangesAsync() > 0);
 }