adb6e9e875
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m2s
- 포트 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>
62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using TaxBaik.Application.Services;
|
|
|
|
namespace TaxBaik.Web.Pages;
|
|
|
|
public class ContactModel : PageModel
|
|
{
|
|
private readonly InquiryService _inquiryService;
|
|
|
|
[BindProperty]
|
|
public string Name { get; set; } = "";
|
|
|
|
[BindProperty]
|
|
public string Phone { get; set; } = "";
|
|
|
|
[BindProperty]
|
|
public string? Email { get; set; }
|
|
|
|
[BindProperty]
|
|
public string ServiceType { get; set; } = "기타";
|
|
|
|
[BindProperty]
|
|
public string Message { get; set; } = "";
|
|
|
|
[BindProperty]
|
|
public bool Agree { get; set; }
|
|
|
|
public ContactModel(InquiryService inquiryService)
|
|
{
|
|
_inquiryService = inquiryService;
|
|
}
|
|
|
|
public async Task<IActionResult> OnPostAsync()
|
|
{
|
|
if (!ModelState.IsValid || !Agree)
|
|
{
|
|
return Page();
|
|
}
|
|
|
|
try
|
|
{
|
|
var ipAddress = HttpContext.Connection.RemoteIpAddress?.ToString();
|
|
await _inquiryService.SubmitAsync(Name, Phone, ServiceType, Message, ipAddress);
|
|
TempData["Success"] = "상담 신청이 접수되었습니다. 빠른 시간 내에 연락드리겠습니다.";
|
|
return RedirectToPage();
|
|
}
|
|
catch (ValidationException ex)
|
|
{
|
|
ModelState.AddModelError("", ex.Message);
|
|
return Page();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
// DB 연결 실패 등의 경우에도 사용자에게 성공 메시지 표시
|
|
// 실제 환경에서는 별도의 로깅 및 이메일 알림 필요
|
|
ModelState.AddModelError("", "시스템 오류가 발생했습니다. 잠시 후 다시 시도해주세요.");
|
|
return Page();
|
|
}
|
|
}
|
|
}
|