private void ListProductsByProductName(string key) { using (NorthWindContext context = new NorthWindContext()) { dgwProduct.DataSource = context.Products.Where(p => p.ProductName.ToLower().Contains(key.ToLower())).ToList(); } }
private void ListProducts() { using (NorthWindContext context = new NorthWindContext()) { dgwProduct.DataSource = context.Products.ToList(); } }
private void ListProductsByCategoryId(int categoryId) { using (NorthWindContext context = new NorthWindContext()) { dgwProduct.DataSource = context.Products.Where(p => p.CategoryId == categoryId).ToList(); } }
private void ListProducts() { using (NorthWindContext context = new NorthWindContext()) // idisposible format - garbage collector beklemeden memory den bitirmek. { dgwProduct.DataSource = context.Products.ToList(); } }
public void ListProductsByCategoryName(int categoryId) { using (NorthWindContext context = new NorthWindContext()) { dataGridView1.DataSource = context.Products.Where(p => p.CategoryId == categoryId).ToList(); } }
public List <Product> ListByProductName(string key) { using (NorthWindContext context = new NorthWindContext()) { return(context.Products.Where(p => p.ProductName.Contains(key)).ToList()); } }
private void ListCategories() { using (NorthWindContext context = new NorthWindContext()) { cmbCategory.DataSource = context.Categories.ToList(); cmbCategory.DisplayMember = "CategoryName"; cmbCategory.ValueMember = "CategoryId"; } }
private void ListCategories() { using (NorthWindContext context = new NorthWindContext()) // idisposible format - garbage collector beklemeden memory den bitirmek. { cbxCategory.DataSource = context.Categories.ToList(); cbxCategory.DisplayMember = "CategoryName"; cbxCategory.ValueMember = "CategoryId"; } }
private void txtCategory_SelectedIndexChanged(object sender, EventArgs e) { NorthWindContext context = new NorthWindContext(); ListProductsByCategoryName(txtCategory.SelectedIndex); }