Beispiel #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();
     }
 }
Beispiel #2
0
 private void ListProductsByCategory(int categoryid)
 {
     using (NorthWindContext context = new NorthWindContext())
     {
         dgwProduct.DataSource = context.Products.Where(p => p.CategoryId == categoryid).ToList();
     }
 }
Beispiel #3
0
 private void ListProducts()
 {
     using (NorthWindContext context = new NorthWindContext())
     {
         dgwProduct.DataSource = context.Products.ToList();
     }
 }
Beispiel #4
0
 private void ListCategories()
 {
     using (NorthWindContext context = new NorthWindContext())
     {
         cbxCategory.DataSource    = context.Categories.ToList();
         cbxCategory.DisplayMember = "CategoryName";
         cbxCategory.ValueMember   = "CategoryId";
     }
 }