async void OnSaveButtonClicked(object sender, EventArgs e) { string quickVictory; if (quickPicker.SelectedItem == null) { quickVictory = "N/A"; } else { var selectedQuickVictory = quickPicker.SelectedItem as QuickVictories; quickVictory = selectedQuickVictory.Desc; } var victory = new TheVictory() { Title = title.Text ?? quickVictory ?? "No title", Quick = quickVictory, Details = details.Text ?? "No details were entered.", Date = DateTime.UtcNow }; await App.Database.SaveVictoryAsync(victory); await DisplayAlert( "You have just celebrated a Victory!", "Your Victory has been saved for future celebrations.", "Woohoo!" ); await Navigation.PopAsync(); }
public Task <int> DeleteVictoryAsync(TheVictory victory) { return(_database.DeleteAsync(victory)); }
public Task <int> SaveVictoryAsync(TheVictory victory) { return(victory.Id != 0 ? _database.UpdateAsync(victory) : _database.InsertAsync(victory)); }