public bool DeleteOrderSupplementReference(IOrderSupplement orderSupplement) => _context.Execute(@" DELETE FROM OrderSupplements WHERE OrderId = @orderid AND SupplementId = @supplementid ", new { orderid = orderSupplement.OrderId, supplementid = orderSupplement.SupplementId }) != 0;
public int GetOrderSupplementId(IOrderSupplement orderSupplement) => _context.ExecuteScalar <int>(@" SELECT OrderSupplementId FROM OrderSupplements WHERE OrderId = @orderid AND SupplementId = @supplementid ", new { orderid = orderSupplement.OrderId, supplementid = orderSupplement.SupplementId });
public bool InsertOrderSupplementReference(IOrderSupplement orderSupplement) { orderSupplement.OrderSupplementId = GetIdForNextOrderSupplement(); if (orderSupplement.OrderSupplementId == 0) { orderSupplement.OrderSupplementId++; } return(_context.Execute(@" INSERT OrderSupplements (OrderSupplementId, OrderId, SupplementId) VALUES (@ordersupplementid, @orderid, @supplementid) ", new { ordersupplementid = orderSupplement.OrderSupplementId, orderid = orderSupplement.OrderId, supplementid = orderSupplement.SupplementId }) != 0); }