Issue with ternary operator in Radzen inline dialog

I have some code that works perfectly well in my component but as soon as I try and use in within a Radzen inline dialog it stops working. The issue in particular is trying to use the ternary operator to add a a conditional CSS class.

My (simplified) code for the inline dialog is as follows:

@code {
    async Task ShowPromptsDialog()
    {
        var result = await _dialogService.OpenAsync("View Prompts for " + aspectDto.Name, ds =>
    @<div class="row">
        <div class="col-12">
            @foreach (var prompt in aspectDto.PromptRows.Select(x => x.Prompts.Where(y => y.PromptRowId == 1 && y.PromptColumnId == 1).FirstOrDefault()))
            {
                if (formAspectDataDto.SelectedPrompts != null && prompt != null)
                {
                    <div role="button" class="card card-body @(formAspectDataDto.SelectedPrompts.Where(x => x == prompt.Id).Any() ? "light" : "")"
                     style="font-size: 14px; height: 100%;" @onclick="() => TogglePrompt(prompt.Id)">
                        <span class="p-0">@prompt.PromptText</span>
                    </div>
                }
            }
        </div>
    </div>);
    }
}

Upon clicking the div it calls the TogglePrompt method which then adds the prompt ID into the list of selected prompts. This should then trigger the "light" class to be applied and this is how it works when I run this code in the component as opposed to the inline dialog.

Is there some formatting or syntax I'm missing/doing wrong to get the ternary operator to be recognised?

Not sure how this is related to the dialog at all - if you are looking for razor syntax rules you can refer to Microsoft official documentation. In this case it will be better to construct the class before the OpenAsync() call and later assign it as variable.