private void updateButton_Click(object sender, RoutedEventArgs e) { int songId = Convert.ToInt32(songIdComboBox.SelectedItem); Console.WriteLine("Updating song " + songId); Song s = new Song() { Title = titleTextBox.Text, Artist = artistTextBox.Text, Album = albumTextBox.Text, Genre = genreTextBox.Text, Length = lengthTextBox.Text, Filename = filenameTextBox.Text }; if (musicLib.UpdateSong(songId, s)) { titleTextBox.Text = s.Title; artistTextBox.Text = s.Artist; albumTextBox.Text = s.Album; genreTextBox.Text = s.Genre; lengthTextBox.Text = s.Length; filenameTextBox.Text = s.Filename; } }
private void UpdateCommand_Executed(object sender, ExecutedRoutedEventArgs e) { string songId = songIdComboBox.SelectedItem.ToString(); Console.WriteLine("Updating song " + songId); Song song = new Song { Title = titleTextBox.Text, Artist = artistTextBox.Text, Album = albumTextBox.Text, Filename = filenameTextBox.Text, Length = lengthTextBox.Text, Genre = genreTextBox.Text }; musicLib.UpdateSong(Convert.ToInt32(songId), song); }
private void UpdateCommand_Executed(object sender, ExecutedRoutedEventArgs e) { int songId = Convert.ToInt32(songIdComboBox.SelectedItem); Console.WriteLine("Updating song " + songId); Song updatedSong = new Song(); updatedSong.Title = titleTextBox.Text; updatedSong.Artist = artistTextBox.Text; updatedSong.Album = albumTextBox.Text; updatedSong.Genre = genreTextBox.Text; updatedSong.Length = lengthTextBox.Text; updatedSong.Filename = filenameTextBox.Text; musicLib.UpdateSong(songId, updatedSong); }