コード例 #1
0
        /// <summary>
        /// Simulates one of our "Save Pages"
        /// Receives All the Data From Front End to Save
        /// </summary>
        /// <param name="row"></param>
        public void OnPost()
        {
            FakeDb db = new FakeDb();

            // Build Sql with Parameters to minimize risk of Sql Injection
            var sql = "Update UserId Set Owner = :Owner Where UserId = :UserId ";

            // Go through All the Data to Save
            // Ideally there would be a changed indicator to not save everything
            foreach (User user in Users)
            {
                // Because of the Parameters Dapper can automatically bind the Properties of User to the Sql
                db.Execute(sql, user);
            }
        }