private void RefreshCategories() { this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, (ThreadStart) delegate { using (var context = new ManagerDbContext()) { categoriesComboBox.ItemsSource = context.Categories.ToList(); } }); }
private void RefreshProducts(Category category) { this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, (ThreadStart) delegate { using (var context = new ManagerDbContext()) { productsComboBox.ItemsSource = context.Products.Where(x => x.Category.Id.Equals(category.Id)).ToList(); } }); }