Esempio n. 1
0
        private void LoadCustomerToList()
        {
            TrainingEntities db = new TrainingEntities();

            foreach (var item in db.Customers)
            {
                listBoxCustomer.Items.Add(item.name);
            }
        }
Esempio n. 2
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            TrainingEntities db = new TrainingEntities();

            listBoxCustomer.Items.Clear();
            var searchResult = db.Customers.Where(c => c.name.Contains(txtName.Text));

            foreach (var item in searchResult)
            {
                listBoxCustomer.Items.Add(item.name);
            }
        }