From 55933649f6e1220178b434a733f48571710da4d2 Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Thu, 9 Jul 2026 11:33:17 +0900 Subject: [PATCH] Standardize admin pages and blog editor --- .../Pages/Admin/Announcements/Index.cshtml | 32 ++++++- .../Pages/Admin/Announcements/Index.cshtml.cs | 15 ++- .../Pages/Admin/Blog/Create.cshtml | 83 ++++++++++++++++- .../Pages/Admin/Blog/Create.cshtml.cs | 29 +++++- src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml | 85 ++++++++++++++++- .../Pages/Admin/Blog/Edit.cshtml.cs | 61 ++++++++++++- src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml | 76 +++++++++++++++- .../Pages/Admin/Blog/Index.cshtml.cs | 20 +++- .../Pages/Admin/Clients/Index.cshtml | 91 ++++++++++++++++++- .../Pages/Admin/Clients/Index.cshtml.cs | 40 +++++++- .../Pages/Admin/Companies/Index.cshtml | 32 ++++++- .../Pages/Admin/Companies/Index.cshtml.cs | 18 +++- src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml | 32 ++++++- .../Pages/Admin/Faqs/Index.cshtml.cs | 15 ++- .../Pages/Admin/Inquiries/Index.cshtml | 52 ++++++++++- .../Pages/Admin/Inquiries/Index.cshtml.cs | 20 +++- .../Pages/Admin/TaxProfiles/Index.cshtml | 32 ++++++- .../Pages/Admin/TaxProfiles/Index.cshtml.cs | 15 ++- .../Pages/Admin/_AdminLayout.cshtml | 36 +++++--- src/TaxBaik.Web/Pages/Blog/Post.cshtml.cs | 3 +- .../Pages/Shared/PaginationModel.cs | 4 + .../Pages/Shared/_AdminPageHeader.cshtml | 20 ++++ .../Pages/Shared/_AdminSidebar.cshtml | 15 ++- .../Pages/Shared/_EmptyState.cshtml | 6 +- .../Pages/Shared/_Pagination.cshtml | 7 +- .../Pages/Shared/_StatusBadge.cshtml | 12 ++- .../wwwroot/js/admin-blog-editor.js | 42 +++++++++ 27 files changed, 825 insertions(+), 68 deletions(-) create mode 100644 src/TaxBaik.Web/Pages/Shared/PaginationModel.cs create mode 100644 src/TaxBaik.Web/Pages/Shared/_AdminPageHeader.cshtml create mode 100644 src/TaxBaik.Web/wwwroot/js/admin-blog-editor.js diff --git a/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml index e63efee..d23b5b7 100644 --- a/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml @@ -1,4 +1,34 @@ @page @model TaxBaik.Web.Pages.Admin.Announcements.IndexModel @{ ViewData["Title"] = "공지사항"; } -

공지사항 관리

+ +
+ +
+
+ + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var item in Model.Items) + { + + + + + + + } + } + +
제목유형활성정렬
@item.Title@item.DisplayType@item.SortOrder
+
+
+
diff --git a/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml.cs index 0fe5930..ba3bc8b 100644 --- a/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Announcements/Index.cshtml.cs @@ -1,7 +1,16 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; +using TaxBaik.Domain.Entities; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Announcements; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Announcements; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class IndexModel(AnnouncementService announcementService) : PageModel +{ + public List Items { get; private set; } = []; + + public async Task OnGetAsync(CancellationToken ct = default) + => Items = (await announcementService.GetAllAsync(ct)).ToList(); +} diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml b/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml index 50ba78a..483a706 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml @@ -1,4 +1,83 @@ @page @model TaxBaik.Web.Pages.Admin.Blog.CreateModel -@{ ViewData["Title"] = "블로그 등록"; } -

블로그 등록

+@{ + ViewData["Title"] = "블로그 등록"; +} + +
+
+
+ +
+
+
+
+
+ +
+ + + +
+
+ +
+ + + + + +
+
+
HTML 태그는 그대로 저장되고 홈페이지에서 렌더링됩니다.
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+

미리보기

+
+
+
+
+
+
+
+ +@section Scripts { + +} diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml.cs index 44f328d..6fa00bf 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Create.cshtml.cs @@ -1,7 +1,30 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.DTOs; +using TaxBaik.Application.Services; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Blog; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class CreateModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Blog; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class CreateModel(BlogService blogService) : PageModel +{ + [BindProperty] + public CreateBlogPostDto Input { get; set; } = new() + { + Content = string.Empty, + Title = string.Empty + }; + + public IActionResult OnGet() => Page(); + + public async Task OnPostAsync(CancellationToken ct) + { + if (!ModelState.IsValid) + return Page(); + + await blogService.CreateAsync(Input, ct); + return RedirectToPage("/Admin/Blog/Index"); + } +} diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml b/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml index a74f8ef..83e6fdb 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml @@ -1,4 +1,85 @@ @page "{id:int}" @model TaxBaik.Web.Pages.Admin.Blog.EditModel -@{ ViewData["Title"] = "블로그 수정"; } -

블로그 수정

+@{ + ViewData["Title"] = "블로그 수정"; +} + +
+
+
+ +
+
+
+
+
+ + +
+ + +
+
+ +
+ + + + + +
+
@Html.Raw(Model.Input.Content)
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+

미리보기

+
+
@Html.Raw(Model.Input.Content)
+
+
+
+
+
+ +@section Scripts { + +} diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml.cs index e15493a..a5f9907 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Edit.cshtml.cs @@ -1,7 +1,62 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.DTOs; +using TaxBaik.Application.Services; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Blog; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class EditModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Blog; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class EditModel(BlogService blogService) : PageModel +{ + [BindProperty(SupportsGet = true)] + public int Id { get; set; } + + [BindProperty] + public CreateBlogPostDto Input { get; set; } = new() + { + Content = string.Empty, + Title = string.Empty + }; + + public async Task OnGetAsync(CancellationToken ct) + { + var post = await blogService.GetByIdAsync(Id, ct); + if (post is null) + return NotFound(); + + Input = new CreateBlogPostDto + { + Title = post.Title, + Content = post.Content, + CategoryId = post.CategoryId, + Tags = post.Tags, + SeoTitle = post.SeoTitle, + SeoDescription = post.SeoDescription, + ThumbnailUrl = post.ThumbnailUrl, + IsPublished = post.IsPublished, + AuthorId = post.AuthorId + }; + + return Page(); + } + + public async Task OnPostAsync(CancellationToken ct) + { + if (!ModelState.IsValid) + return Page(); + + var updated = await blogService.UpdateAsync(Id, Input, ct); + if (updated is null) + return NotFound(); + + return RedirectToPage("/Admin/Blog/Index"); + } + + public async Task OnPostDeleteAsync(CancellationToken ct) + { + await blogService.DeleteAsync(Id, ct); + return RedirectToPage("/Admin/Blog/Index"); + } +} diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml index d8289ac..d93af7a 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml @@ -1,4 +1,76 @@ @page @model TaxBaik.Web.Pages.Admin.Blog.IndexModel -@{ ViewData["Title"] = "블로그"; } -

블로그 관리

+@{ + ViewData["Title"] = "블로그"; +} + +
+ + +
+
+
+
+ + +
+
+ + 초기화 + 내린 글 보기 +
+
+
+
+ +
+
+ + + + + + + + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var post in Model.Items) + { + + + + + + + + } + } + +
제목발행조회수작성일작업
+
@post.Title
+
@post.Slug
+
@post.ViewCount@post.CreatedAt.ToString("yyyy-MM-dd") + 수정 + 보기 +
+
+
+
diff --git a/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml.cs index b48cf6c..f4e2317 100644 --- a/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Blog/Index.cshtml.cs @@ -1,7 +1,25 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; +using TaxBaik.Domain.Entities; using TaxBaik.Web.Services; namespace TaxBaik.Web.Pages.Admin.Blog; [Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +public class IndexModel(BlogService blogService) : PageModel +{ + public List Items { get; private set; } = []; + public string? SearchQuery { get; set; } + public async Task OnGetAsync(string? searchQuery, bool showArchived = false, CancellationToken ct = default) + { + SearchQuery = searchQuery; + var posts = showArchived + ? await blogService.GetArchivedPagedAsync(1, 100, ct) + : await blogService.GetAdminPagedAsync(1, 100, ct); + Items = posts.Item1 + .Where(p => string.IsNullOrWhiteSpace(searchQuery) || + p.Title.Contains(searchQuery, StringComparison.OrdinalIgnoreCase) || + (p.Content?.Contains(searchQuery, StringComparison.OrdinalIgnoreCase) ?? false)) + .ToList(); + } +} diff --git a/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml index 8a255ab..9efce1f 100644 --- a/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml @@ -1,4 +1,91 @@ @page @model TaxBaik.Web.Pages.Admin.Clients.IndexModel -@{ ViewData["Title"] = "클라이언트"; } -

클라이언트 목록

Blazor 관리자 화면을 Razor Pages로 전환하는 자리입니다.

+@{ + ViewData["Title"] = "고객 관리"; +} + +
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var item in Model.Items) + { + + + + + + + + + } + } + +
고객명회사명전화상태등록일작업
@item.Name@item.CompanyName@item.Phone@item.CreatedAt.ToString("yyyy-MM-dd") + 상세 + 수정 +
+
+
+ + +
diff --git a/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml.cs index 67a487e..a35ebf8 100644 --- a/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Clients/Index.cshtml.cs @@ -1,7 +1,41 @@ using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Clients; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Clients; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class IndexModel(ClientService clientService) : PageModel +{ + public List Items { get; private set; } = []; + public int CurrentPage { get; private set; } = 1; + public int TotalPages { get; private set; } = 1; + public int TotalCount { get; private set; } + public string? Search { get; set; } + public string? Status { get; set; } + public int PageSize { get; set; } = 10; + + public async Task OnGetAsync(string? search, string? status, int page = 1, int pageSize = 10, CancellationToken ct = default) + { + Search = search; + Status = status; + PageSize = pageSize; + CurrentPage = Math.Max(1, page); + + var (items, total) = await clientService.GetPagedAsync(CurrentPage, PageSize, status, search, ct); + Items = items.ToList(); + TotalCount = total; + TotalPages = Math.Max(1, (int)Math.Ceiling(total / (double)PageSize)); + } + + public string BuildPageUrl(int page) => + $"/admin/clients?search={Uri.EscapeDataString(Search ?? string.Empty)}&status={Uri.EscapeDataString(Status ?? string.Empty)}&page={page}&pageSize={PageSize}"; + + public async Task OnPostDeleteAsync(int id, CancellationToken ct) + { + await clientService.DeleteAsync(id, ct); + return RedirectToPage(); + } +} diff --git a/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml index 64b4a28..521872e 100644 --- a/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml @@ -1,4 +1,34 @@ @page @model TaxBaik.Web.Pages.Admin.Companies.IndexModel @{ ViewData["Title"] = "회사"; } -

회사 관리

+ +
+ +
+
+ + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var item in Model.Items) + { + + + + + + + } + } + +
코드회사명담당자활성
@item.CompanyCode@item.CompanyName@item.ContactPerson
+
+
+
diff --git a/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml.cs index 8a40464..e01a67c 100644 --- a/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Companies/Index.cshtml.cs @@ -1,7 +1,19 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; +using TaxBaik.Domain.Entities; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Companies; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Companies; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class IndexModel(CompanyService companyService) : PageModel +{ + public List Items { get; private set; } = []; + + public async Task OnGetAsync(CancellationToken ct = default) + { + var (items, _) = await companyService.GetPagedAsync(1, 100, ct); + Items = items.ToList(); + } +} diff --git a/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml index 39c8f55..b171905 100644 --- a/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml @@ -1,4 +1,34 @@ @page @model TaxBaik.Web.Pages.Admin.Faqs.IndexModel @{ ViewData["Title"] = "FAQ"; } -

FAQ 관리

+ +
+ +
+
+ + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var item in Model.Items) + { + + + + + + + } + } + +
질문카테고리활성정렬
@item.Question@item.Category@item.SortOrder
+
+
+
diff --git a/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml.cs index 4a840a8..1d661d4 100644 --- a/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Faqs/Index.cshtml.cs @@ -1,7 +1,16 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; +using TaxBaik.Domain.Entities; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Faqs; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Faqs; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class IndexModel(FaqService faqService) : PageModel +{ + public List Items { get; private set; } = []; + + public async Task OnGetAsync(CancellationToken ct = default) + => Items = (await faqService.GetAllAsync(ct)).ToList(); +} diff --git a/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml index a327c27..0a4d421 100644 --- a/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml @@ -1,4 +1,54 @@ @page @model TaxBaik.Web.Pages.Admin.Inquiries.IndexModel @{ ViewData["Title"] = "문의"; } -

문의 관리

+ +
+ +
+
+
+
+ + +
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var item in Model.Items) + { + + + + + + + + } + } + +
이름전화서비스상태등록일
@item.Name@item.Phone@item.ServiceType@item.CreatedAt.ToString("yyyy-MM-dd")
+
+
+
diff --git a/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml.cs index 0c91637..c8eb5af 100644 --- a/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/Inquiries/Index.cshtml.cs @@ -1,7 +1,21 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; +using TaxBaik.Domain.Entities; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.Inquiries; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.Inquiries; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class IndexModel(InquiryService inquiryService) : PageModel +{ + public List Items { get; private set; } = []; + public string? Status { get; set; } + + public async Task OnGetAsync(string? status = null, CancellationToken ct = default) + { + Status = status; + var (items, _) = await inquiryService.GetPagedAsync(1, 100, status, ct); + Items = items.ToList(); + } +} diff --git a/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml b/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml index c5a7e7e..98ed947 100644 --- a/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml @@ -1,4 +1,34 @@ @page @model TaxBaik.Web.Pages.Admin.TaxProfiles.IndexModel @{ ViewData["Title"] = "세무 프로필"; } -

세무 프로필 관리

+ +
+ +
+
+ + + + + + @if (Model.Items.Count == 0) + { + + } + else + { + foreach (var item in Model.Items) + { + + + + + + + } + } + +
고객ID사업유형세무위험다음신고일
@item.ClientId@item.BusinessType@item.NextFilingDueDate?.ToString("yyyy-MM-dd")
+
+
+
diff --git a/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml.cs b/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml.cs index 0a9d289..3834a8a 100644 --- a/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Admin/TaxProfiles/Index.cshtml.cs @@ -1,7 +1,16 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc.RazorPages; +using TaxBaik.Application.Services; +using TaxBaik.Domain.Entities; using TaxBaik.Web.Services; -namespace TaxBaik.Web.Pages.Admin.TaxProfiles; -[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] -public class IndexModel : PageModel { } +namespace TaxBaik.Web.Pages.Admin.TaxProfiles; + +[Authorize(AuthenticationSchemes = AdminAuthDefaults.Scheme)] +public class IndexModel(TaxProfileService taxProfileService) : PageModel +{ + public List Items { get; private set; } = []; + + public async Task OnGetAsync(CancellationToken ct = default) + => Items = (await taxProfileService.GetAllAsync(ct)).ToList(); +} diff --git a/src/TaxBaik.Web/Pages/Admin/_AdminLayout.cshtml b/src/TaxBaik.Web/Pages/Admin/_AdminLayout.cshtml index 4fb1905..9c98dfd 100644 --- a/src/TaxBaik.Web/Pages/Admin/_AdminLayout.cshtml +++ b/src/TaxBaik.Web/Pages/Admin/_AdminLayout.cshtml @@ -6,23 +6,35 @@ @(ViewData["Title"] ?? "TaxBaik Admin") - + - -
-
- -
- @RenderBody() -
+
+ +
+
+
+ +
+ @RenderBody() +
+
+
- + @await RenderSectionAsync("Scripts", required: false) - diff --git a/src/TaxBaik.Web/Pages/Blog/Post.cshtml.cs b/src/TaxBaik.Web/Pages/Blog/Post.cshtml.cs index 5643717..09e3d39 100644 --- a/src/TaxBaik.Web/Pages/Blog/Post.cshtml.cs +++ b/src/TaxBaik.Web/Pages/Blog/Post.cshtml.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using TaxBaik.Application.Services; using TaxBaik.Domain.Entities; -using System.Net; namespace TaxBaik.Web.Pages.Blog; @@ -22,7 +21,7 @@ public class BlogPostModel : PageModel Post = await _blogService.GetBySlugAsync(slug); if (Post != null) { - HtmlContent = WebUtility.HtmlEncode(Post.Content ?? "").Replace("\r\n", "
").Replace("\n", "
"); + HtmlContent = Post.Content ?? string.Empty; _ = _blogService.IncrementViewCountAsync(Post.Id); } } diff --git a/src/TaxBaik.Web/Pages/Shared/PaginationModel.cs b/src/TaxBaik.Web/Pages/Shared/PaginationModel.cs new file mode 100644 index 0000000..0d5cc2c --- /dev/null +++ b/src/TaxBaik.Web/Pages/Shared/PaginationModel.cs @@ -0,0 +1,4 @@ +namespace TaxBaik.Web.Pages.Shared; + +public sealed record PaginationModel(int Page, int TotalPages, Func BuildPageUrl); + diff --git a/src/TaxBaik.Web/Pages/Shared/_AdminPageHeader.cshtml b/src/TaxBaik.Web/Pages/Shared/_AdminPageHeader.cshtml new file mode 100644 index 0000000..9a2869f --- /dev/null +++ b/src/TaxBaik.Web/Pages/Shared/_AdminPageHeader.cshtml @@ -0,0 +1,20 @@ +@model (string Eyebrow, string Title, string Subtitle, string? ActionHref, string? ActionText) + + diff --git a/src/TaxBaik.Web/Pages/Shared/_AdminSidebar.cshtml b/src/TaxBaik.Web/Pages/Shared/_AdminSidebar.cshtml index 4684539..da7fce4 100644 --- a/src/TaxBaik.Web/Pages/Shared/_AdminSidebar.cshtml +++ b/src/TaxBaik.Web/Pages/Shared/_AdminSidebar.cshtml @@ -1,8 +1,13 @@ - - +
diff --git a/src/TaxBaik.Web/Pages/Shared/_EmptyState.cshtml b/src/TaxBaik.Web/Pages/Shared/_EmptyState.cshtml index 88799b9..f605774 100644 --- a/src/TaxBaik.Web/Pages/Shared/_EmptyState.cshtml +++ b/src/TaxBaik.Web/Pages/Shared/_EmptyState.cshtml @@ -1,5 +1,5 @@ @model string -
-
@(string.IsNullOrWhiteSpace(Model) ? "데이터가 없습니다." : Model)
+
+
+

@(string.IsNullOrWhiteSpace(Model) ? "데이터가 없습니다." : Model)

- diff --git a/src/TaxBaik.Web/Pages/Shared/_Pagination.cshtml b/src/TaxBaik.Web/Pages/Shared/_Pagination.cshtml index ba20feb..a2aa63b 100644 --- a/src/TaxBaik.Web/Pages/Shared/_Pagination.cshtml +++ b/src/TaxBaik.Web/Pages/Shared/_Pagination.cshtml @@ -1,8 +1,8 @@ -@model dynamic +@model TaxBaik.Web.Pages.Shared.PaginationModel @if (Model.TotalPages > 1) { -