Add Job Listing Skills to Job Listing

This commit is contained in:
2025-08-25 17:31:49 -07:00
parent 662d6f332c
commit e92e4c329f
11 changed files with 69 additions and 10 deletions
@@ -228,6 +228,8 @@ namespace BoredCareers.Services.DatabaseService {
Description = @Description,
ModifiedTime = @ModifiedTime,
IsDeleted = @IsDeleted;
SELECT LAST_INSERT_ID();
";
MySqlCommand cmd = new MySqlCommand(command, connection);
@@ -247,9 +249,17 @@ namespace BoredCareers.Services.DatabaseService {
cmd.Parameters.AddWithValue("@ModifiedTime", DateTime.UtcNow);
cmd.Parameters.AddWithValue("@IsDeleted", jobListing.IsDeleted);
await cmd.ExecuteNonQueryAsync();
object? result = await cmd.ExecuteScalarAsync();
int jobListingID = 0;
if (jobListing.ID != null && jobListing.ID != 0) {
jobListingID = Convert.ToInt32(jobListing.ID);
} else {
cmd.CommandText = "";
jobListingID = Convert.ToInt32(result);
}
foreach (JobListingSkill cur in jobListing.Skills) {
cur.JobListingID = jobListingID;
await SetJobListingSkills(cur);
}
}
@@ -43,7 +43,7 @@ namespace BoredCareers.Services.DatabaseService {
using( MySqlConnection connection = GetConnection() ) {
await connection.OpenAsync();
string command = @"
INSERT INTO JobListing
INSERT INTO JobListingSkill
(ID,JobListingID,Name,Description)
VALUES
(@ID,@JobListingID,@Name,@Description)