无法在 .NET Core 中使用 if 显示文本

Cant show text with if in .NET core

我在 item.estado 中有一个布尔值,如果为真,我想显示“Pendiente”,如果为假,我想显示“Terminado”,但这不起作用。

                    <div class="d-flex w-100 justify-content-between">
                        <h4 class="mb-1">@Html.DisplayFor(modelItem => item.id_consulta)</h4>
                        <small class="text-muted">@{if(item.estado){Html.DisplayText("Pendiente");} else {Html.DisplayText("Terminado");}}</small>
                    </div>
                    <p class="mb-2">Nombre solicitud: @Html.DisplayFor(modelIte)</p>
                </a>```

我结束了使用 <text><\text> 而不是 html.DisplayText()

<small class="text-muted">@{if(item.estado){<text>Pendiente</text>;} else {<text>Terminado</text>;}}</small>