private static void InsertOrderItem(IDbConnection dbConnection, OrderItem orderItem) { dbConnection.InsertOnly(orderItem, ev => ev.Insert(oi => new {oi.OrderId, oi.BagId, oi.Quantity, oi.UnitPrice})); var orderItemId = dbConnection.GetLastInsertId(); orderItem.Id = Convert.ToUInt32(orderItemId); }
public void Add(OrderItem orderItem) { if (OrderStatus != OrderStatus.Unpaid) { throw new InvalidOperationException("Unable to add lines to an order after it have been paid"); } if (orderItem == null) { throw new ArgumentNullException("orderItem"); } if (id > 0) { orderItem.OrderId = Id; } orderItems.Add(orderItem); }
public void Remove(OrderItem orderItem) { if (orderItem == null) { throw new ArgumentNullException("orderItem"); } orderItems.Remove(orderItem); }