Ejemplo n.º 1
0
 private void buttonUpdate_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new NorthwindEntities1())
     {
         var CustomerSearch = db.Customers.First(customer => customer.Country == "Finland");
         if (CustomerSearch != null)
         {
             CustomerSearch.ContactName = textBox01.Text;
             buttonUpdate.Content       = string.Format("Name Updated !!! Now {0}", CustomerSearch.ContactName);
         }
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        private void buttonDisplayItems_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new NorthwindEntities1()) {
                var customers =
                    from customer in db.Customers
                    select customer;

                foreach (var customer in customers)
                {
                    textBlock01.Text += customer.ContactName + Environment.NewLine;
                }

                var CustomerSearch = db.Customers.First(customer => customer.Country == "Finland");
                buttonUpdate.Content = string.Format("Update Name : Currently {0}", CustomerSearch.ContactName);
            }
        }