static private void DeleteArtPiece() { Console.Clear(); Console.WriteLine("------ Delete Art Piece ------ \n"); Console.Write("Type the art piece ID: "); string pieceID = Console.ReadLine(); while (pieceID.Length != 5 || gal.SearchArtPiece(pieceID) == null) { Console.WriteLine("Invalid ID!Please try again."); pieceID = Console.ReadLine(); } gal.DeleteArtPiece(pieceID); Console.WriteLine(); Console.WriteLine("Art piece deleted!Press any key to continue."); Console.ReadLine(); }
private void DeletePiece_Click(object sender, RoutedEventArgs e) { piecesText.Text = ""; if (pieceID.Text == "") { MessageBox.Show("Art Piece ID is required!"); return; } ArtPiece p = gal.DeleteArtPiece(pieceID.Text); if (p != null) { piecesText.Text = "Art Piece deleted!\n"; piecesText.Text += p.ToString(); } else { MessageBox.Show("Art Piece ID not registred!"); return; } }