private async void pkrState_SelectedIndexChanged(object sender, EventArgs e) { try { if (InternetConnection) { overlay.IsVisible = true; objStateCity = Task.Run(() => App.TodoManager.GetStateOrCity(objeKyorType, pkrState.SelectedItem.ToString())).Result; List <string> lstCity = objStateCity.data; lstCity.Insert(0, "Any"); pkrCity.ItemsSource = lstCity; pkrCity.SelectedItem = "Any"; overlay.IsVisible = false; } else { var Retry = await DisplayAlert("No Connection", "Please Check Your Connection", "Retry", "Cancel"); if (Retry) { pkrState_SelectedIndexChanged(sender, e); } } } catch (Exception ex) { DependencyService.Get <IMessage>().LongAlert(); } }
void Bind(eKyorType eKyorType, string StateName, string CityName) { overlay.IsVisible = true; objStateCity = Task.Run(() => App.TodoManager.GetStateOrCity(eKyorType)).Result; List <string> lstState = objStateCity.data; lstState.Insert(0, "Any"); pkrState.ItemsSource = lstState; if (StateName != "") { pkrState.SelectedItem = StateName; } if (CityName != "") { pkrCity.SelectedItem = CityName; } overlay.IsVisible = false; }
public bool Create(City model, int countryId, int stateId) { using (var context = new CourseContext()) { City entity = model; if (countryId != 0) { Country country = context.Country.Find(countryId); if (country != null) { CountryCity countryCity = new CountryCity() { Country = country, City = entity }; context.Add(countryCity); } } if (stateId != 0) { State state = context.State.Find(stateId); if (state != null) { StateCity stateCity = new StateCity() { State = state, City = entity }; context.Add(stateCity); } } if (countryId == 0 && stateId == 0) { context.City.Add(entity); } context.SaveChanges(); return(true); } }
public StateCityZip(StateCity stateAndCity, ZipCode zipPlusFour) { StateAndCity = stateAndCity; ZipPlusFour = zipPlusFour; }
public async Task <ActionResult <StateCity> > Post(StateCity resource) { var saved = await _repository.AddAsync(resource); return(CreatedAtAction(nameof(Get), new { id = saved.GetKey() }, saved)); }