From 8a232b3e2d05a3b72af74f2b13f992c73997e3ce Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Fri, 5 Feb 2021 12:57:10 +0330 Subject: [PATCH] #65 fixes for import --- .../GanjoorService-MySqlImports.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/RMuseum/Services/Implementation/GanjoorService-Imports/GanjoorService-MySqlImports.cs b/RMuseum/Services/Implementation/GanjoorService-Imports/GanjoorService-MySqlImports.cs index 55a8f324..747b4d4e 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Imports/GanjoorService-MySqlImports.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Imports/GanjoorService-MySqlImports.cs @@ -41,8 +41,6 @@ namespace RMuseum.Services.Implementation var job = (await jobProgressServiceEF.NewJob("GanjoorService:ImportFromMySql", "pre open connection")).Result; - - MusicCatalogueService catalogueService = new MusicCatalogueService(Configuration, context); RServiceResult musicCatalogueRes = await catalogueService.ImportFromMySql("MusicCatalogueImportFromMySql", jobProgressServiceEF, job); @@ -354,19 +352,19 @@ namespace RMuseum.Services.Implementation await context.SaveChangesAsync(); - await jobProgressServiceEF.UpdateJob(job.Id, 100, "Finished", true); + } catch (Exception jobExp) { await jobProgressServiceEF.UpdateJob(job.Id, job.Progress, "", false, jobExp.ToString()); } - var resComments = await _ImportCommentsDataFromMySql("_ImportCommentsDataFromMySql", context, jobProgressServiceEF, job); if (!resComments.Result) { - return; } + + await jobProgressServiceEF.UpdateJob(job.Id, 100, "Finished", true); } }); @@ -531,7 +529,6 @@ namespace RMuseum.Services.Implementation context.GanjoorComments.Add(comment); - await context.SaveChangesAsync(); //keeping original order of comments by saving things here i++; @@ -543,6 +540,8 @@ namespace RMuseum.Services.Implementation } } + await context.SaveChangesAsync(); + } }