public override void Start() { base.Start(); try { SelectedCounty = Counties.FirstOrDefault(x => x.Id == 0); SelectedSubCounty = SubCounties.FirstOrDefault(x => x.Id == 0); SelectedWard = Wards.FirstOrDefault(x => x.Id == 0); } catch { } }
public override void LoadFromStore(VMStore modelStore) { try { ContactAddress = JsonConvert.DeserializeObject <ClientContactAddressDTO>(modelStore.Store); PersonId = ContactAddress.PersonId; Downloaded = ContactAddress.Downloaded; Telephone = ContactAddress.Phone; Landmark = ContactAddress.Landmark; ContactId = ContactAddress.ContactId; AddressId = ContactAddress.AddressId; SelectedCounty = Counties.FirstOrDefault(x => x.Id == 0); SelectedSubCounty = SubCounties.FirstOrDefault(x => x.Id == 0); SelectedWard = Wards.FirstOrDefault(x => x.Id == 0); if (ContactAddress.CountyId.HasValue && ContactAddress.CountyId.Value > 0) { SelectedCounty = Counties.FirstOrDefault(x => x.Id == ContactAddress.CountyId); GetSubCounties(); } if (ContactAddress.SubCountyId.HasValue && ContactAddress.SubCountyId.Value > 0) { SelectedSubCounty = SubCounties.FirstOrDefault(x => x.Id == ContactAddress.SubCountyId); GetWards(); } if (ContactAddress.WardId.HasValue && ContactAddress.WardId.Value > 0) { SelectedWard = Wards.FirstOrDefault(x => x.Id == ContactAddress.WardId); } } catch (Exception e) { Mvx.Error(e.Message); } }