Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4010

the problem is in getting address using API the region is displaying in front end but the provinces, municipalities, and barangays is not displayed [closed]

$
0
0

// For Full address of user

//the problem is in getting address using API the region is displaying in front end but the provinces, municipalities, and barangays is not displayed.private async Task LoadRegionAsync(){var regionResponse = await HttpClient.GetFromJsonAsync<List>("https://psgc.gitlab.io/api/regions/");regions = regionResponse ?? new List();await LoadProvinceAsync();}

    private async Task LoadProvinceAsync()    {        var provinceResponse = await HttpClient.GetFromJsonAsync<List<Province>>($"https://psgc.gitlab.io/api/regions/");        provinces = provinceResponse ?? new List<Province>();        await LoadCitiesAsync();    }    private async Task LoadCitiesAsync()    {        var citiesResponse = await HttpClient.GetFromJsonAsync<List<City>>($"https://psgc.gitlab.io/api/provinces/");        cities = citiesResponse ?? new List<City>();        await LoadBarangaysAsync();    }    private async Task LoadBarangaysAsync()    {        var barangaysResponse = await HttpClient.GetFromJsonAsync<List<Barangay>>($"https://psgc.gitlab.io/api/municipalities/");        barangays = barangaysResponse ?? new List<Barangay>();    }    private int GetIdFromSelected(string selectedCode, List<dynamic> options)    {        foreach (var item in options)        {            if (item?.Code == selectedCode)            {                return item?.Id ?? 0;            }        }        return 0;    }

Viewing all articles
Browse latest Browse all 4010

Trending Articles