private void btnDelete_Click(object sender, RoutedEventArgs e) { if (advertWindow.SelectedIndex > -1) { AdvertRepo.DeleteAd(Convert.ToInt32( AdvertTable.Rows[advertWindow.SelectedIndex]["AdID"])); } PopulateDataGrid(); }
private void btnCreateAd_Click(object sender, RoutedEventArgs e) { if (AdID == 0) { AdvertRepo.NewAd(txtNewTitle.Text, txtNewAdText.Text, float.Parse(txtPrice.Text), Convert.ToInt32(cboCategoriesBox.SelectedValue), currentUserID); } else { AdvertRepo.DeleteAd(AdID); AdvertRepo.NewAd(txtNewTitle.Text, txtNewAdText.Text, float.Parse(txtPrice.Text), Convert.ToInt32(cboCategoriesBox.SelectedValue), currentUserID); } ((MainWindow)Application.Current.MainWindow).PopulateDataGrid(); this.Close(); }