public int CreateOrder(int customerID) { // --------------------- Order order = new Order { OrdersID = 0, FKMenuCustomerID = customerID, DateOrder = DateTime.Now }; SaveOrder(order); return order.OrdersID; }
public void SaveOrder(Order order) { // If its a new product, just attach it to the DataContext if (order.OrdersID == 0) orderTable.InsertOnSubmit(order); else if (orderTable.GetOriginalEntityState(order) == null) { // Were updating an existing menu item, but its not attached to the // this data context, so attach it and detect the changes orderTable.Attach(order); orderTable.Context.Refresh(RefreshMode.KeepCurrentValues, order); } orderTable.Context.SubmitChanges(); }
public void DeleteItems(Order orders) { orderTable.DeleteOnSubmit(orders); orderTable.Context.SubmitChanges(); }
public void CompleteOrder(Order order) { orderTable.Attach(order); orderTable.Context.Refresh(RefreshMode.KeepCurrentValues, order); orderTable.Context.SubmitChanges(); }