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