From 2240f8c22232b7eda1a2baa18100b6ca730f29fa Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Tue, 23 Sep 2025 11:59:29 +0330 Subject: [PATCH] bug fix --- RMuseum/Services/Implementation/GanjoorService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index a47a9e68..16e2828f 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -2963,7 +2963,11 @@ namespace RMuseum.Services.Implementation public async Task> BreakPoemAsync(int poemId, int vOrder, Guid userId) { var poem = (await GetPoemById(poemId, true, false, true, false, false, false, false, true, true)).Result; - var parentPage = await _context.GanjoorPages.AsNoTracking().Where(p => p.GanjoorPageType == GanjoorPageType.CatPage && p.CatId == poem.Category.Cat.Id).SingleAsync(); + var parentPage = await _context.GanjoorPages.AsNoTracking().Where(p => p.GanjoorPageType == GanjoorPageType.CatPage && p.CatId == poem.Category.Cat.Id).SingleOrDefaultAsync(); + if(parentPage == null) + { + parentPage = await _context.GanjoorPages.AsNoTracking().Where(p => p.GanjoorPageType == GanjoorPageType.PoetPage && p.CatId == poem.Category.Cat.Id).SingleAsync(); + } var poemTitleStaticPart = "شمارهٔ"; if (poem.Next == null) {