public void Add(Order order)
 {
     using (var db = new orderDB())
     {
         db.Order.Add(order);
         db.SaveChanges();
     }
 }
 public void Update(Order order)
 {
     using (var db = new orderDB())
     {
         db.Order.Attach(order);
         db.Entry(order).State = EntityState.Modified;
         order.Details.ForEach(
             item => db.Entry(item).State = EntityState.Modified);
         db.SaveChanges();
     }
 }
        public void Delete(String orderId)
        {
            using (var db = new orderDB())
            {
                var order = db.Order.Include("details").SingleOrDefault(o => o.Id == orderId);
                db.OrderDetails.RemoveRange(order.Details);

                db.Order.Remove(order);

                db.SaveChanges();
            }
        }