From 8acc98817447fffa5cdcd16a1ecec57156a880cb Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Thu, 9 Jul 2026 16:09:54 +0900 Subject: [PATCH] Fix blog category fallback and empty card --- src/TaxBaik.Application/Services/BlogService.cs | 2 ++ src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml | 12 +++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/TaxBaik.Application/Services/BlogService.cs b/src/TaxBaik.Application/Services/BlogService.cs index b7010c6..10293da 100644 --- a/src/TaxBaik.Application/Services/BlogService.cs +++ b/src/TaxBaik.Application/Services/BlogService.cs @@ -54,6 +54,7 @@ public class BlogService( public async Task CreateAsync(BlogPost post, CancellationToken ct = default) { ValidatePost(post); + post.CategoryId ??= await EnsureCategoryIdAsync(0, ct); post.Title = post.Title.Trim(); post.Content = post.Content.Trim(); post.Slug = await GenerateUniqueSlugAsync(post.Title, ct: ct); @@ -88,6 +89,7 @@ public class BlogService( public async Task UpdateAsync(BlogPost post, CancellationToken ct = default) { + post.CategoryId ??= await EnsureCategoryIdAsync(0, ct); await repository.UpdateAsync(post, ct); memoryCache.Remove(AdminDashboardService.CacheKey); } diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml index 1220bc3..be79301 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml @@ -25,16 +25,10 @@ @if (Model.Items.Count == 0) { -
-
- - - - - - +
+
+ @await Html.PartialAsync("_EmptyState", "블로그 글이 없습니다.")
-

블로그 글이 없습니다.

} else