@using MongoDB.Bson; Host @if (Agent is not null) { @if (Agent.Hosts is not null && Agent.Hosts.Any()) { Select Unassign Cancel } else { Assign Cancel } } @code { private bool _visible; public void Toggle() { _visible = !_visible; StateHasChanged(); } }