Cleanup
This commit is contained in:
@@ -21,10 +21,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
|
|
||||||
using( DbDataReader reader = await cmd.ExecuteReaderAsync() ) {
|
using( DbDataReader reader = await cmd.ExecuteReaderAsync() ) {
|
||||||
while( await reader.ReadAsync() ) {
|
while( await reader.ReadAsync() ) {
|
||||||
if( reader == null ) {
|
if( reader == null ) { break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _id = reader.GetInt32("ID");
|
int _id = reader.GetInt32("ID");
|
||||||
string _username = reader.GetString("UserName");
|
string _username = reader.GetString("UserName");
|
||||||
string _email = reader.GetString("Email");
|
string _email = reader.GetString("Email");
|
||||||
@@ -56,7 +53,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Account?> GetAccount( int ID ) {
|
public async Task<Account?> GetAccount( int AccountID ) {
|
||||||
Account? account = null;
|
Account? account = null;
|
||||||
using( MySqlConnection connection = GetConnection() ) {
|
using( MySqlConnection connection = GetConnection() ) {
|
||||||
connection.Open();
|
connection.Open();
|
||||||
@@ -67,7 +64,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
";
|
";
|
||||||
|
|
||||||
MySqlCommand cmd = new MySqlCommand(command, connection);
|
MySqlCommand cmd = new MySqlCommand(command, connection);
|
||||||
cmd.Parameters.AddWithValue("@ID", ID);
|
cmd.Parameters.AddWithValue("@ID", AccountID);
|
||||||
|
|
||||||
using( DbDataReader reader = await cmd.ExecuteReaderAsync() ) {
|
using( DbDataReader reader = await cmd.ExecuteReaderAsync() ) {
|
||||||
while( await reader.ReadAsync() ) {
|
while( await reader.ReadAsync() ) {
|
||||||
@@ -144,7 +141,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteAccount( int ID ) {
|
public async Task DeleteAccount( int AccountID ) {
|
||||||
using( MySqlConnection connection = GetConnection() ) {
|
using( MySqlConnection connection = GetConnection() ) {
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
connection.Open();
|
connection.Open();
|
||||||
@@ -153,7 +150,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
DELETE FROM Account WHERE ID = @ID;
|
DELETE FROM Account WHERE ID = @ID;
|
||||||
";
|
";
|
||||||
cmd = new MySqlCommand( command, connection );
|
cmd = new MySqlCommand( command, connection );
|
||||||
cmd.Parameters.AddWithValue("@ID", ID);
|
cmd.Parameters.AddWithValue("@ID", AccountID);
|
||||||
|
|
||||||
await cmd.ExecuteNonQueryAsync();
|
await cmd.ExecuteNonQueryAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteResume( int ID ) {
|
public async Task DeleteResume( int ResumeID ) {
|
||||||
using( MySqlConnection connection = GetConnection() ) {
|
using( MySqlConnection connection = GetConnection() ) {
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
connection.Open();
|
connection.Open();
|
||||||
@@ -227,7 +227,7 @@ namespace BoredCareers.Services.DatabaseService {
|
|||||||
DELETE FROM Resume WHERE ID = @ID;
|
DELETE FROM Resume WHERE ID = @ID;
|
||||||
";
|
";
|
||||||
cmd = new MySqlCommand( command, connection );
|
cmd = new MySqlCommand( command, connection );
|
||||||
cmd.Parameters.AddWithValue("@ID", ID);
|
cmd.Parameters.AddWithValue("@ID", ResumeID);
|
||||||
|
|
||||||
await cmd.ExecuteNonQueryAsync();
|
await cmd.ExecuteNonQueryAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user