/// <summary> /// Method to delete the given LocationModel from each database /// </summary> /// <param name="model"></param> private async void DeleteModelAsync(LocationModel model) { // Remove from the ObservableCollection this.LocationModels.Remove(model); // Set the delete flag model.Deleted = true; // Save this item to the database as deleted so that it can be deleted if the api call fails databaseHelper.SaveItemsAsync(model); // Try to delete this item from the API database, await response befoe continuing this exectuion bool deleted = await apiHelper.DeleteLocationModelAsync(model); // Delete the item from the local database if successfully deleted from API database if (deleted) { databaseHelper.DeleteItemAsync(model); } }
public void SaveLocationModel(LocationModel location) { databaseHelper.SaveLocationModelAsync(location); apiHelper.SaveLocationModelAsync(location); }