Exemplo n.º 1
0
        private void btnEliminar_Click(object sender, RoutedEventArgs e)
        {
            Producto producto = null;

            try
            {
                producto = (Producto)tableProductos.SelectedItem;
                if (!(producto == null))
                {
                    crud.borrarProductoPorId(producto.Id);
                    MessageBox.Show("Eliminado correctamente");
                    listarProductos();
                }
                else
                {
                    MessageBox.Show("Seleccione un producto");
                }
            } catch (Exception ex)
            {
                MessageBox.Show("Seleccione un producto");
            }
        }