private void deletebtn_Click(object sender, RoutedEventArgs e) { try { var deleteWarning = MessageBox.Show("Να διαγραφεί ο πελάτης;", "Διαγραφή", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.No, MessageBoxOptions.DefaultDesktopOnly); if (deleteWarning == MessageBoxResult.OK) { var selectedCustomer = ((Button)sender); string selectedCustomerId = selectedCustomer.Tag.ToString(); _customerModelView.DeleteSelectedCustomer(selectedCustomerId); _customerModelView.GetCustomers(); } } catch (Exception exce) { MainWindowModel.Instance.IsFailVisible = Visibility.Visible; MainWindowModel.Instance.MessageStatus = exce.Message; Log_Handler.LogHandling.Instance.StoreLog("ShowCustomer", "DeleteBtn_Click", exce.Message, DateTime.Now); } }
public ShowCustomer() { InitializeComponent(); DataContext = _customerModelView = new ModelView.CustomerModelView(); _customerModelView.GetCustomers(); }