private async Task <Domain.Models.Profile> SaveProfile(Domain.Models.Profile profile) { var profilesRealm = new Domain.Services.Realms.Profiles(); var profileLocalId = 0; await profilesRealm.WriteAsync(realm => { realm.Manage(profile); profileLocalId = profile.LocalId; profile.Synced = true; }); var savedProfile = profilesRealm.Get(profileLocalId); return(savedProfile); }
private async Task SaveExistingProfile() { if (!Validate()) { return; } var profilesRealm = new Domain.Services.Realms.Profiles(); var profileLocalId = GetCurrentUser().Profile.LocalId; await profilesRealm.WriteAsync(realm => { var profile = realm.Get(profileLocalId); var mapper = new Domain.Utilities.PropertyMapper(); mapper.Map <Domain.Models.Profile>(ProfileModel, profile); profile.Synced = false; }); var synchronizer = new Domain.Services.Sync.Synchronizer(); await synchronizer.SyncPostsAndWait(); await Navigator.PopAsync(Navigation); }