Ejemplo n.º 1
0
 public Customer AddCustomer(Customer customer)
 {
     using (var entities = new HillStationEntities())
     {
         entities.Customers.Add(customer);
         entities.SaveChanges();
         entities.Entry(customer).Reload();
         return customer;
     }
 }
Ejemplo n.º 2
0
 private void Save()
 {
     using (var entities = new HillStationEntities())
     {
         foreach (var header in Headers)
         {
             entities.Headers.Attach(header);
             entities.Entry(header).State = EntityState.Modified;
             foreach (var meal in header.Meals)
             {
                 entities.Meals.Attach(meal);
                 entities.Entry(meal).State = EntityState.Modified;
             }
         }
         entities.SaveChanges();
         OnMenuOpdated(new MenuUpdatedEventArgs {UpdateOperation = UpdateOperation.Updated});
     }
 }