public async Task <TEntity> Add(TEntity entity) { context.Set <TEntity>().Add(entity); await context.SaveChangesAsync(); return(entity); }
public async Task <User> Register(User user, string password) { byte[] passHash, passSalt; CreatePasswordHash(password, out passHash, out passSalt); user.PasswordHash = passHash; user.PasswordSalt = passSalt; await _context.User.AddAsync(user); await _context.SaveChangesAsync(); return(user); }