Example #1
0
        public void AddUser(User user, string password)
        {
            string hash = BCrypt.Net.BCrypt.HashPassword(password);

            using var ctx     = new SimpleAdsContext(_connectionString);
            user.PasswordHash = hash;
            ctx.Users.Add(user);
            ctx.SaveChanges();
        }
Example #2
0
 public void AddSimpleAd(SimpleAd ad)
 {
     using var ctx = new SimpleAdsContext(_connectionString);
     ctx.Ads.Add(ad);
     ctx.SaveChanges();
 }