public void Update(Contestant contestant) { using (var con = new SqlConnection(connectionString)) { con.Open(); using (var com = new SqlCommand()) { com.Connection = con; com.CommandText = "UPDATE Contestants SET [name] = @Name, ind_score = @IndScore, team_name = @TeamName, team_score = @TeamScore, fav_obstacle = @FavObstacle WHERE Id = @id"; com.Parameters.AddWithValue("@Id", contestant.Id); com.Parameters.AddWithValue("@Name", contestant.Name); com.Parameters.AddWithValue("@IndScore", contestant.IndScore); com.Parameters.AddWithValue("@TeamName", contestant.TeamName); com.Parameters.AddWithValue("@TeamScore", contestant.TeamScore); com.Parameters.AddWithValue("@FavObstacle", contestant.FavObstacle); com.ExecuteNonQuery(); } } }
static void UpdateContestant(IDatabase database, Contestant contestant) { database.Update(contestant); }
static void AddContestant(IDatabase database, Contestant contestant) { database.Create(contestant); }
public void Update(Contestant contestant) { throw new NotImplementedException(); }