コード例 #1
0
 public void Update(User user)
 {
     using (IDbConnection db = Connection)
     {
         var sqlQuerry = "UPDATE users SET username = @username, passwordhash = @passwordhash, salt = @salt WHERE id = @Id";
         db.Execute(sqlQuerry, new
         {
             username     = user.Username,
             passwordhash = user.GetPasswordHash(),
             salt         = user.GetSalt()
         });
     }
 }
コード例 #2
0
 public void Register(User user)
 {
     using (IDbConnection db = Connection)
     {
         var sqlQuerry = "INSERT INTO users (username, passwordhash, salt) VALUES(@username, @passwordhash, @salt)";
         db.Execute(sqlQuerry, new
         {
             username     = user.Username,
             passwordhash = user.GetPasswordHash(),
             salt         = user.GetSalt()
         });
     }
 }