Exemple #1
0
 public void AddSimpleAd(SimpleAd ad)
 {
     ad.Date = DateTime.Now;
     using (var context = new SimpleAdsContext(_connectionString))
     {
         context.Ads.Add(ad);
         context.SaveChanges();
     }
 }
Exemple #2
0
        public void AddUser(User user, string password)
        {
            string hash = BCrypt.Net.BCrypt.HashPassword(password);

            user.PasswordHash = hash;
            using (var context = new SimpleAdsContext(_connectionString))
            {
                context.Users.Add(user);
                context.SaveChanges();
            }
        }