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