- 포트 5001로 설정 (기존 5012 → 5001) - DB 연결 없이도 페이지 렌더링 가능하도록 error handling 추가 - Index.cshtml.cs: 블로그 로드 실패 시 빈 리스트 반환 - Blog/Index.cshtml.cs: 카테고리 및 포스트 로드 실패 시 빈 리스트 반환 - Contact.cshtml.cs: 문의 제출 실패 시 사용자 친화적 에러 메시지 - Program.cs: 마이그레이션을 non-blocking으로 변경 페이지 구성: - 홈페이지 (Index): 회사 소개 및 최근 블로그 - 블로그 (Blog): 게시글 목록 및 카테고리 필터 - 서비스 (Services): 서비스 소개 - 문의 (Contact): 상담 신청 폼 - 소개 (About): 회사 정보 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,11 +25,23 @@ public class BlogIndexModel : PageModel
|
||||
|
||||
public async Task OnGetAsync(int page = 1, int? categoryId = null)
|
||||
{
|
||||
CurrentPage = page;
|
||||
SelectedCategoryId = categoryId;
|
||||
Categories = (await _categoryRepository.GetAllAsync()).ToList();
|
||||
var (posts, total) = await _blogService.GetPublishedPagedAsync(page, PageSize, categoryId);
|
||||
Posts = posts.ToList();
|
||||
TotalPages = (total + PageSize - 1) / PageSize;
|
||||
try
|
||||
{
|
||||
CurrentPage = page;
|
||||
SelectedCategoryId = categoryId;
|
||||
Categories = (await _categoryRepository.GetAllAsync()).ToList();
|
||||
var (posts, total) = await _blogService.GetPublishedPagedAsync(page, PageSize, categoryId);
|
||||
Posts = posts.ToList();
|
||||
TotalPages = (total + PageSize - 1) / PageSize;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// DB 연결 실패 시 빈 리스트로 처리
|
||||
CurrentPage = page;
|
||||
SelectedCategoryId = categoryId;
|
||||
Categories = new List<Category>();
|
||||
Posts = new List<BlogPost>();
|
||||
TotalPages = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user