public void Initialize(PostCase entity) { Initialize(); SelectedId = entity.Id; Context.Text = entity.Context; Created.SelectedDate = entity.Created; Thread.SelectedItem = entity.Thread; Account.SelectedItem = entity.Account; }
private void Update_Click(object sender, RoutedEventArgs e) { if (PostTable.SelectedIndex >= 0) { PostCase Item = (dynamic)PostTable.SelectedItem; PostEditView.IsEnabled = true; PostEditView.Visibility = Visibility.Visible; PostEditView.Initialize(Item); EditHeight.Height = new GridLength(120); } }
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 && PostTable.SelectedIndex >= 0) { PostCase Item = (dynamic)PostTable.SelectedItem; db.Posts.Remove(db.Posts.Where(e => e.Id == Item.Id).Single()); db.SaveChanges(); Initialize(); } }