public void ViewSong(String id) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { IQueryable <vsb_songbook> entityQuery = from slist in context.SongBooks where slist.ID.Equals(id) select slist; vsb_songbook songview = entityQuery.FirstOrDefault(); context.SongBooks.DeleteOnSubmit(songview); context.SubmitChanges(); } }
public void AddSongBook(String title, String content, String icon) { using (AppDatabase context = new AppDatabase(AppDatabase.DBConnectionString)) { vsb_songbook newsong = new vsb_songbook(); newsong.Icon = icon; newsong.Title = title; newsong.Content = content; context.SongBooks.InsertOnSubmit(newsong); context.SubmitChanges(); } }
private void MainListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (MainListBox.SelectedIndex == -1) { return; } vsb_songbook myresults = MainListBox.SelectedItem as vsb_songbook; //settings.CurrSongSetting = myresults.ID - 1; NavigationService.Navigate(new Uri("/DdSongView.xaml?selectedSong=" + (myresults.ID - 1).ToString(), UriKind.Relative)); MainListBox.SelectedIndex = -1; }