public PhoneCongregationRealm ConvertToSession() { var session = new PhoneCongregationRealm(); MapTo(session); return(session); }
public void SavePhoneCongregation(PhoneCongregationRealm phoneCongregation) { using (Realm realm = CreateNewRealmInstance()) { realm.Write(() => realm.Add(phoneCongregation)); } }
public void MapTo(PhoneCongregationRealm phoneCongregationRealm) { phoneCongregationRealm.Name = Name; phoneCongregationRealm.Address = Address; phoneCongregationRealm.City = City; phoneCongregationRealm.District = District; phoneCongregationRealm.FaxPhoneNumber = FaxPhoneNumber; phoneCongregationRealm.PhoneNumber = PhoneNumber; phoneCongregationRealm.ZipCode = ZipCode; }
public async Task <List <PhoneCongregation> > GetAllPhonesFromApi() { var api = new ApiPhoneCongregationService(); ApiReturn <IList <PhoneCongregation> > objectReturned = await api.GetAllPhoneCongregations(); if (objectReturned.Success) { foreach (var item in objectReturned.Object) { PhoneCongregationRealm sessao = item.ConvertToSession(); SavePhoneCongregation(sessao); } } return(GetAllPhonesFromRealm().ToList()); }