diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index be5b46b3..3ab86d7c 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -337,16 +337,7 @@ namespace RMuseum.Services.Implementation page.Poem = poemRes.Result; } break; - case GanjoorPageType.PoetPage: - { - var poetRes = await GetPoetById((int)dbPage.PoetId); - if(!string.IsNullOrEmpty(poetRes.ExceptionString)) - { - return new RServiceResult(null, poetRes.ExceptionString); - } - page.PoetOrCat = poetRes.Result; - } - break; + case GanjoorPageType.CatPage: { var catRes = await GetCatById((int)dbPage.CatId); @@ -357,6 +348,19 @@ namespace RMuseum.Services.Implementation page.PoetOrCat = catRes.Result; } break; + default: + { + if (dbPage.PoetId != null) + { + var poetRes = await GetPoetById((int)dbPage.PoetId); + if (!string.IsNullOrEmpty(poetRes.ExceptionString)) + { + return new RServiceResult(null, poetRes.ExceptionString); + } + page.PoetOrCat = poetRes.Result; + } + } + break; } return new RServiceResult(page); @@ -993,7 +997,7 @@ namespace RMuseum.Services.Implementation : GanjoorPageType.None; - int? poetId = row["post_author"].ToString() == "0" ? (int?)null : int.Parse(row["post_author"].ToString()); + int? poetId = row["post_author"].ToString() == "1" ? (int?)null : int.Parse(row["post_author"].ToString()); if (poetId == 36)//رشحه { continue; @@ -1017,7 +1021,7 @@ namespace RMuseum.Services.Implementation UrlSlug = row["post_name"].ToString(), HtmlText = row["post_content"].ToString(), ParentId = row["post_parent"].ToString() == "0" ? (int?)null : int.Parse(row["post_parent"].ToString()), - PoetId = row["post_author"].ToString() == "1" ? (int?)null : int.Parse(row["post_author"].ToString()), + PoetId = poetId, SecondPoetId = row["other_poet_id"] == DBNull.Value ? (int?)null : int.Parse(row["other_poet_id"].ToString()), PostDate = (DateTime)row["post_date"] };