Add Job Listing Skills to Job Listing
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user