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

                cbxCategory.DataSource = context.Categories.ToList();
            }
        }