Skip to content

Commit

Permalink
DeleteScores function implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Riza Shabanaj committed Aug 28, 2024
1 parent e70867c commit f66eb22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion service/src/PingPong/Controllers/ScoreController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ScoreController(ScoreService scoreService)
_scoreService = scoreService;
}

[HttpGet(nameof(DeleteScores))]
[HttpDelete(nameof(DeleteScores))]
public IActionResult DeleteScores()
{
try
Expand Down
2 changes: 2 additions & 0 deletions service/src/PingPong/Repositories/Score/IScoreRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ public interface IScoreRepository

void AddScores(PlayerDTO newScores);

void DeleteScores();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public void DeleteScores()
{
using (SQLiteConnection connection = new SQLiteConnection(_sqlitePath))
{
connection.Open();
string deleteQuery = "DELETE FROM PlayerItems";
using (SQLiteCommand command = new SQLiteCommand(deleteQuery, connection))
using (var conn = new SQLiteConnection(_sqlitePath))
{
command.ExecuteNonQuery();
conn.Open();
var cmd = new SQLiteCommand("DELETE FROM PlayerItems", conn);
cmd.ExecuteNonQuery();
}
}
}
Expand Down

0 comments on commit f66eb22

Please sign in to comment.