Beispiel #1
0
 public void Insert(Order order)
 {
     using (var db = new OrderDB())
     {
         db.Entry(order).State = EntityState.Added;
         db.SaveChanges();
     }
 }
Beispiel #2
0
 public void Remove(String orderId)
 {
     using (var db = new OrderDB())
     {
         var order = db.Order.Include("items").SingleOrDefault(o => o.Id == orderId);
         db.OrderItem.RemoveRange(order.Items);
         db.Order.Remove(order);
         db.SaveChanges();
     }
 }