public async void PushToCloud(Scene scene) { if (!AppService.IsConnected()) return; try { if (scene.MSId != 0) { int id = scene.Id; scene.Id = scene.MSId; scene.MSId = id; await mstScene.UpdateAsync(scene); scene.Id = id; } else { scene.Id = 0; await mstScene.InsertAsync(scene); AppDatabase.Current.UpdateSceneField(scene.AggregateId, "MSId", scene.Id, false); } Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" }); } catch { Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" }); } }
public async void AddUpdateScene(Scene scene) { LoggingService.LogInformation("writing to db 'Scene'", "AppDatabase.AddUpdateScene"); var found = RetrieveScene(scene.AggregateId); if (found != null && found.Count() > 0) { this.SqliteDb.Update(scene); //await mstScene.UpdateAsync(scene); } else { var newId = this.SqliteDb.Insert(scene); //await mstScene.InsertAsync(scene); } Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("updating ...") { Identifier = "DB", SourceId = "Scene" }); Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("") { Identifier = "AGGREGATE", AggregateId = scene.AggregateId, Action = "UPDATED" }); }