private void BtnDelete(object sender, RoutedEventArgs e) { using (var db = new DBEntity()) { db.Dictionary.Remove(wordTranslate); db.SaveChanges(); } WindowUpdate(); }
private void BtnUpdate(object sender, RoutedEventArgs e) { wordTranslate.Word = tbxWord.Text; wordTranslate.Translate = tbxTranslate.Text; using (var db = new DBEntity()) { db.Dictionary.Update(wordTranslate); db.SaveChanges(); } WindowUpdate(); }
private void BtnAdd(object sender, RoutedEventArgs e) { var wordTranslate = new WordTranslate() { Word = tbxWord.Text, Translate = tbxTranslate.Text }; using (var db = new DBEntity()) { db.Dictionary.Add(wordTranslate); db.SaveChanges(); } WindowUpdate(); }
private void WindowUpdate() { btnUpdate.IsEnabled = false; btnDelete.IsEnabled = false; tbxWord.Text = ""; tbxTranslate.Text = ""; using (var db = new DBEntity()) { db.Dictionary.Load(); dataGrid.ItemsSource = db.Dictionary.Local.ToObservableCollection(); } CollectionViewSource.GetDefaultView(dataGrid.ItemsSource).Filter = ToFilter; }