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