I have two class models :
Country.cs
public class Country{ public long Id { get; set; } public string Code { get; set; } public string Name { get; set; }}Airport.cs
public class Airport : BaseModel{ public long Id { get; set; } public string IATA { get; set; } public string ICAO { get; set; } public string Name { get; set; } public long CountryId { get; set; }}In a form that create/edit an airport object, I want to use FluentAutocomplete so the user can search and selected a CountryId.
<FluentAutocomplete TOption="Country" Items="countries" AutoComplete="ComboboxAutocomplete.List" Label="Country" Placeholder="Select country" OptionText="@(c => c.Name)" OptionValue="@(c => c.Id.ToString())" @bind-value="SelectedCountry" Required Style="width: 80%" />and the SelectedCountry variable :
private string? SelectedCountry{ get => Content.CountryId.ToString(); set { if (long.TryParse(value, out var Id)) { Content.CountryId = Id; } }}The problem is in the setter of SelectedCountry, the value received is the value of current selected Country.Name
I've used another framework that the binded value can be set to "c => c.Id" but in Fluent it accept string only
How can I make the value selected is @context.CountryId