Thread on the server better

This commit is contained in:
2025-08-04 16:27:41 -07:00
parent 109306dda2
commit 35018d921b
4 changed files with 85 additions and 25 deletions
@@ -10,7 +10,7 @@ namespace BoredCareers.Services.DatabaseService {
public async Task<Company?> GetCompany( int CompanyID ) {
Company? company = null;
using( MySqlConnection connection = GetConnection() ) {
connection.Open();
await connection.OpenAsync();
string command = @"
SELECT *
FROM Company
@@ -22,7 +22,6 @@ namespace BoredCareers.Services.DatabaseService {
using( DbDataReader reader = await cmd.ExecuteReaderAsync() ) {
while( await reader.ReadAsync() ) {
if( reader == null ) { break; }
int _id = reader.GetInt32("ID");
string _name = reader.GetString("Name");
string _email = reader.GetString("Email");
@@ -58,8 +57,7 @@ namespace BoredCareers.Services.DatabaseService {
public async Task<int> SetCompany( Company company ) {
using (MySqlConnection connection = GetConnection()) {
connection.Open();
await connection.OpenAsync();
string command = @"
INSERT INTO Company
(ID,Name,Email,EmailVerified,WebsiteURL,Logo,Phone,PostalCode,Country,StateOrRegion,City,Description)
@@ -104,7 +102,7 @@ namespace BoredCareers.Services.DatabaseService {
public async Task DeleteCompany( int CompanyID ) {
using( MySqlConnection connection = GetConnection() ) {
MySqlCommand cmd;
connection.Open();
await connection.OpenAsync();
string command = @"
DELETE FROM Company WHERE ID = @ID;