using Microsoft.AspNetCore.Mvc.RazorPages; using TaxBaik.Application.Services; using TaxBaik.Domain.Entities; using Markdig; namespace TaxBaik.Web.Pages.Blog; public class BlogPostModel : PageModel { private readonly BlogService _blogService; public BlogPost? Post { get; set; } public string? HtmlContent { get; set; } public BlogPostModel(BlogService blogService) { _blogService = blogService; } public async Task OnGetAsync(string slug) { Post = await _blogService.GetBySlugAsync(slug); if (Post != null) { HtmlContent = Markdown.ToHtml(Post.Content ?? ""); _ = _blogService.IncrementViewCountAsync(Post.Id); } } }