TopShelfCustomer/TopShelfCustomer/ViewModels/ChooseStoreViewModel.cs
/// <summary>
/// InitializeNearbyStores:
///
/// Fetches the stores from the API and sets the
/// bindable properties for the ChooseStoreView.
/// </summary>


Fetches the stores from the API and sets the
bindable properties for the ChooseStoreView.
Fetches the stores from the API and sets the bindable properties for the ChooseStoreView .
private async Task InitializeNearbyStores ( int zipCode ) {
                ApiHelper apiHelper = new ApiHelper();
                NearbyStores = new ObservableCollection<Store>();
                var stores = await apiHelper.GetAsync<List<Store>>( "Store/GetStoreByZipCode/" + zipCode );       
                foreach( Store store in stores ) {      
                    NearbyStores.Add( store );
                }
                if ( SelectedStore == null ) {       
                    SelectedStore = NearbyStores[0];
                }
            }
private async Task InitializeNearbyStores ( int zipCode ) { ApiHelper apiHelper = new ApiHelper ( ) ; NearbyStores = new ObservableCollection < Store > ( ) ; var stores = await apiHelper . GetAsync < List < Store > > ( " " + zipCode ) ; foreach ( Store store in stores ) { NearbyStores . Add ( store ) ; } if ( SelectedStore == null ) { SelectedStore = NearbyStores [ 0 ] ; } }
InitializeNearbyStores:
InitializeNearbyStores :
//Get Stores from API //Add the fetched Stores to the observable list. //Check if no store was found to be preferred
zipCode
int