private void Update_Click(object sender, RoutedEventArgs e) { if (ProductCategoryTable.SelectedIndex >= 0) { ProductCase Item = (dynamic)ProductCategoryTable.SelectedItem; ProductCategoryEditView.IsEnabled = true; ProductCategoryEditView.Visibility = Visibility.Visible; ProductCategoryEditView.Initialize(Item); EditHeight.Height = new GridLength(120); } }
public void Initialize(ProductCase entity) { Initialize(); SelectedId = entity.Id; Name.Text = entity.Name; Description.Document = StringToRichTextBox(entity.Description); Price.Text = entity.Price.ToString(); Publisher.Text = entity.Publisher; Developer.Text = entity.Developer; Category.SelectedItem = entity.Category; }
private void Remove_Click(object sender, RoutedEventArgs e) { var result = MessageBox.Show("Are you sure to delete selected data?", "Требуется подстверждение!", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes && ProductTable.SelectedIndex >= 0) { ProductCase Item = (dynamic)ProductTable.SelectedItem; db.Products.Remove(db.Products.Where(e => e.Id == Item.Id).Single()); db.SaveChanges(); Initialize(); } }