public void Insert(TimeTraveler timeTraveler) { using (IDbConnection dbConnection = Connection) { dbConnection.Open(); dbConnection.Execute( "insert into timetraveler(FirstName, LastName) " + "values(@FirstName, @LastName);" , new { FirstName = timeTraveler.FirstName, LastName = timeTraveler.LastName } , commandType: CommandType.Text); } }
public void Insert(TimeTraveler timeTraveler) { System.Diagnostics.Debug.WriteLine(timeTraveler.FirstName); System.Diagnostics.Debug.WriteLine(timeTraveler.LastName); System.Diagnostics.Debug.WriteLine(timeTraveler.TimeTravelerId); using (IDbConnection dbConnection = Connection) { dbConnection.Open(); dbConnection.Execute( "insert into timetraveler(FirstName, LastName) " + "values(@FirstName, @LastName);" , new { FirstName = timeTraveler.FirstName, LastName = timeTraveler.LastName } , commandType: CommandType.Text); } }
public void Update(TimeTraveler timeTraveler) { System.Diagnostics.Debug.WriteLine(timeTraveler.FirstName); System.Diagnostics.Debug.WriteLine(timeTraveler.LastName); System.Diagnostics.Debug.WriteLine(timeTraveler.TimeTravelerId); using (IDbConnection dbConnection = Connection) { dbConnection.Open(); dbConnection.Execute( "update timetraveler " + "set FirstName = @FirstName, LastName = @LastName " + "where TimeTravelerId = @TimeTravelerId;" , new { TimeTravelerId = timeTraveler.TimeTravelerId, FirstName = timeTraveler.FirstName, LastName = timeTraveler.LastName } , commandType: CommandType.Text); } }