public void AddURL(URL u)
 {
     using (var context = new URLShortenerDataContext(_connectionString))
     {
         context.URLs.InsertOnSubmit(u);
         context.SubmitChanges();
     }
 }
Пример #2
0
        public void AddUser(User user, string password)
        {
            string passwordSalt = PasswordHelper.GenerateSalt();
            string passwordHash = PasswordHelper.HashPassword(password, passwordSalt);

            user.PasswordSalt = passwordSalt;
            user.PasswordHash = passwordHash;
            using (var context = new URLShortenerDataContext(_connectionString))
            {
                context.Users.InsertOnSubmit(user);
                context.SubmitChanges();
            }
        }