private void ListProductsbyCategory(int categoryId) { using (NortwindContext context = new NortwindContext()) { dgwProduct.DataSource = context.Products.Where(p => p.CategoryId == categoryId).ToList(); } }
private void ListProducts() { using (NortwindContext context = new NortwindContext()) { dgwProduct.DataSource = context.Products.ToList(); } }
private void ListCategories() { using (NortwindContext context = new NortwindContext()) { cbxCategory.DisplayMember = "CategoryName"; cbxCategory.ValueMember = "CategoryId"; cbxCategory.DataSource = context.Categories.ToList(); } }