Пример #1
0
 public void AddUrl(Url url)
 {
     using (var context = new UrlShortenerDataContext(_connectionString))
     {
         context.Urls.InsertOnSubmit(url);
         context.SubmitChanges();
     }
 }
Пример #2
0
 public void AddUser(User user, string password)
 {
     user.PasswordSalt = PasswordHelper.GenerateSalt();
     user.PasswordHash = PasswordHelper.HashPassword(password, user.PasswordSalt);
     using (var context = new UrlShortenerDataContext(_connectionString))
     {
         context.Users.InsertOnSubmit(user);
         context.SubmitChanges();
     }
 }