public void AddSimpleAd(SimpleAd ad) { ad.Date = DateTime.Now; using (var context = new SimpleAdsContext(_connectionString)) { context.Ads.Add(ad); context.SaveChanges(); } }
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(); } }