public void DeleteProduct(object item) { if (CanDeleteProduct(null)) { bool result = false; result = ProductsClient.DeleteProduct(SelectedProduct.ProductID); if (result) { ProductData productJustDeleted = ProductList.First(c => c.ProductID == SelectedProduct.ProductID); ProductList.Remove(productJustDeleted); MessageBox.Show("Delete successful"); } else { MessageBox.Show("Delete failed"); } } }