@{
    var successMessage = TempData["SuccessMessage"] as string;
    var errorMessages = TempData["ErrorMessages"] as string;
}

<div class="pt-2">
    <!-- 성공 메시지 표시 -->
    @if (!string.IsNullOrEmpty(successMessage))
    {
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            @successMessage
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    }

    <!-- 실패 메시지 표시 -->
    @if (!string.IsNullOrEmpty(errorMessages))
    {
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            @errorMessages
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    }

    <!-- 유효성 검증 오류 메시지 표시 -->
    @if (!ViewData.ModelState.IsValid)
    {
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            <ul>
                @foreach (var modelState in ViewData.ModelState.Values)
                {
                    foreach (var error in modelState.Errors)
                    {
                        <li>@error.ErrorMessage</li>
                    }
                }
            </ul>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    }
</div>