[ICommand]
async Task GetStatesAsync(string partname)
{
try
{
var states = await cityService.GetStates(partname);
StatesList.Clear();
foreach (var state in states)
{
var citylist = await cityService.GetCities(state.Id);
state.CityList = citylist;
state.CityCount = citylist.Count;
StatesList.Add(state);
}
}
catch (Exception ex)
{
await App.Current.MainPage.DisplayAlert("Message", ex.Message, "OK");
}
finally
{
}
}
I mean this part
var citylist = await cityService.GetCities(state.Id);
of the code runs once, i.e. for the first time and all states get cities of the first record. What is wrong whith this?