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

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