Exemple #1
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            Result result = DGResults.SelectedItem as Result;

            if (result != null)
            {
                try {
                    Dictionary <string, object> conditions = new Dictionary <string, object>();
                    conditions.Add("ShootedById", result.ShootedById);
                    _resultsModel.Delete <Result>(conditions);
                    _results.Remove(result);
                    MessageBox.Show("The result has been deleted.", "Result deleted !", MessageBoxButton.OK, MessageBoxImage.Information);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, "Attention !", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            DGResults.SelectedIndex = -1;
        }