private void ListProductsByProductName(string key) { using (NorthWindContext context = new NorthWindContext()) { dgwProduct.DataSource = context.Products.Where(p => p.ProductName.ToLower().Contains(tbxSearch.Text)).ToList(); } }
private void ListProductsByCategory(int categoryid) { using (NorthWindContext context = new NorthWindContext()) { dgwProduct.DataSource = context.Products.Where(p => p.CategoryId == categoryid).ToList(); } }
private void ListProducts() { using (NorthWindContext context = new NorthWindContext()) { dgwProduct.DataSource = context.Products.ToList(); } }
private void ListCategories() { using (NorthWindContext context = new NorthWindContext()) { cbxCategory.DataSource = context.Categories.ToList(); cbxCategory.DisplayMember = "CategoryName"; cbxCategory.ValueMember = "CategoryId"; } }