From 8952cbdeeaa3d9891a2dce2f3174a2e94077375e Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 7 Jan 2021 17:29:59 +0330 Subject: [PATCH] #59 fix for orhphan pages --- RMuseum/Services/Implementation/GanjoorService.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index e05c1544..be5b46b3 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -1103,9 +1103,19 @@ namespace RMuseum.Services.Implementation } } } + else + { + cat = await context.GanjoorCategories.Where(c => c.PoetId == page.PoetId && c.ParentId == null).SingleOrDefaultAsync(); + if(cat != null) + { + fullUrl = $"{cat.UrlSlug}/{page.UrlSlug}"; + } + } } } + if (!string.IsNullOrEmpty(fullUrl) && fullUrl.IndexOf('/') != 0) + fullUrl = $"/{fullUrl}"; page.FullUrl = fullUrl; page.FullTitle = fullTitle; @@ -1114,7 +1124,7 @@ namespace RMuseum.Services.Implementation await context.SaveChangesAsync(); - await jobProgressServiceEF.UpdateJob(job.Id, 100, "Finised", true); + await jobProgressServiceEF.UpdateJob(job.Id, 100, "Finished", true); } catch(Exception jobExp) {