コード例 #1
0
 public void Add(Url url)
 {
     using (var context = new UrlShortenerDataContext(_connectionString))
     {
         context.Urls.InsertOnSubmit(url);
         context.SubmitChanges();
     }
 }
コード例 #2
0
        public void AddUser(User user, string password)
        {
            string salt         = PasswordHelper.GenerateSalt();
            string passwordHash = PasswordHelper.HashPassword(password, salt);

            user.PasswordSalt = salt;
            user.PasswordHash = passwordHash;
            using (var context = new UrlShortenerDataContext(_connectionstring))
            {
                context.Users.InsertOnSubmit(user);
                context.SubmitChanges();
            }
        }