refractoring backend

This commit is contained in:
QkoSad
2024-12-09 18:43:03 +02:00
parent 80040638a6
commit 2db33bb966
53 changed files with 814 additions and 2389 deletions
+30
View File
@@ -0,0 +1,30 @@
using System.Net;
using MySql.Data.MySqlClient;
namespace TimelogBackend;
public class Reset : Route
{
public static void HandleRequest(HttpListenerResponse response)
{
try
{
// prepare SQL query
MySqlCommand cmd = new() { CommandText = "CALL InitDB" };
using (MySqlConnection conn = new MySqlConnection(connectionString))
{
cmd.Connection = conn;
// open connection
conn.Open();
// execute query
cmd.ExecuteNonQuery();
// set up and send response
SendSuccess(response);
}
}
catch (Exception ex)
{
SendError(response, ex);
}
}
}