public async Task <bool> SaveShippingAddress() { if (string.IsNullOrEmpty(billingFirstName.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required First Name for billing information", "OK"); return(false); } if (string.IsNullOrEmpty(billingLastName.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required Last Name for billing information", "OK"); return(false); } if (string.IsNullOrEmpty(billingEmail.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required Email for billing information", "OK"); return(false); } if (string.IsNullOrEmpty(billingPhoneNumber.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required Phone Number for billing information", "OK"); return(false); } if (string.IsNullOrEmpty(billingAddressLine1.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required Address for billing information", "OK"); return(false); } if (string.IsNullOrEmpty(billingCity.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required City for billing information", "OK"); return(false); } if (string.IsNullOrEmpty(billingPostalCode.Text)) { await App.Current.MainPage.DisplayAlert("Alert", "Required Postal / Zip code for billing information", "OK"); return(false); } bool returnValue = false; if (App.serverData.mei_user.userAddressList.Count > currentIndex) { BillingInformation billingInformation = new BillingInformation(); billingInformation.firstName = billingFirstName.Text; billingInformation.lastName = billingLastName.Text; billingInformation.email = billingEmail.Text; billingInformation.phone = billingPhoneNumber.Text; billingInformation.addressLine1 = billingAddressLine1.Text; billingInformation.addressLine2 = billingAddressLine2.Text; billingInformation.city = billingCity.Text; billingInformation.postalCode = billingPostalCode.Text; billingInformation.state = states[billingState.SelectedIndex]; billingInformation.country = "US"; App.serverData.mei_user.userAddressList[currentIndex] = billingInformation; bool token = await BaseFunctions.UpdateShippingAddress(App.serverData.mei_user.userAddressList); if (token) { ((HomeLayout)App.Current.MainPage).shippingList.PullToRefresh(); returnValue = true; } else { returnValue = false; } } else { List <BillingInformation> list = App.serverData.mei_user.userAddressList; BillingInformation billingInformation = new BillingInformation(); billingInformation.firstName = billingFirstName.Text; billingInformation.lastName = billingLastName.Text; billingInformation.email = billingEmail.Text; billingInformation.phone = billingPhoneNumber.Text; billingInformation.addressLine1 = billingAddressLine1.Text; billingInformation.addressLine2 = billingAddressLine2.Text; billingInformation.city = billingCity.Text; billingInformation.postalCode = billingPostalCode.Text; billingInformation.state = states[billingState.SelectedIndex]; billingInformation.country = "US"; list.Add(billingInformation); bool token = await BaseFunctions.AddShippingAddress(list); if (token) { returnValue = true; App.serverData.mei_user.userAddressList = list; ((HomeLayout)App.Current.MainPage).shippingList.PullToRefresh(); } else { returnValue = false; } } return(returnValue); }