public void AddPost(Post post)
 {
     using (var context = new HackerNewsDataContext(_connectionString))
     {
         context.Posts.InsertOnSubmit(post);
         context.SubmitChanges();
     }
 }
 public void AddComment(Comment comment)
 {
     using (var context = new HackerNewsDataContext(_connectionString))
     {
         context.Comments.InsertOnSubmit(comment);
         context.SubmitChanges();
     }
 }
        public void AddUser(User user, string password)
        {
            var salt = PasswordHelper.GenerateSalt();
            var hash = PasswordHelper.HashPassword(password, salt);

            user.PasswordHash = hash;
            user.PasswordSalt = salt;

            using (var context = new HackerNewsDataContext(_connectionString))
            {
                context.Users.InsertOnSubmit(user);
                context.SubmitChanges();
            }
        }