private void acceptButton_Click(object sender, RoutedEventArgs e) { { MessageBox.Show("Действие выполнено accept"); var query = (from d in db_bill.Bills select d).ToList(); db_bill.Bills.RemoveRange(query); db_bill.SaveChanges(); this.Close(); } }
private void Del_Target(object sender, RoutedEventArgs e) { if (productList.SelectedItem == null) { return; } // получаем выделенный объект Bill bill = productList.SelectedItem as Bill; db_bill.Bills.Remove(bill); Sum.sum -= bill.Price; TextBlock.Text = Sum.sum.ToString(); db_bill.SaveChanges(); }