Beispiel #1
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            Client client = new Client
            {
                NameEng = "testUser1"
            };

            using (var context = new EntitiesContext())
            {
                context.Clients.Add(client);
                context.SaveChanges();
            }
        }
Beispiel #2
0
 public void SaveClient(Client client)
 {
     using (var context = new EntitiesContext())
     {
         if (client.ClientID != 0)
         {
             context.Entry(client).State = EntityState.Modified;
         }
         else
         {
             context.Entry(client).State = EntityState.Added;
         }
         context.SaveChanges();
     }
 }