public void DeleteOrderProductByOrderId(int orderId)
 {
     Models.DBObjects.OrderProduct productToDelete = dbContext.OrderProducts.FirstOrDefault(x => x.OrderID == orderId);
     if (productToDelete != null)
     {
         dbContext.OrderProducts.DeleteOnSubmit(productToDelete);
         dbContext.SubmitChanges();
     }
 }
        private Models.DBObjects.OrderProduct MapModelToDbObject(OrderProductModel orderProductModel)
        {
            Models.DBObjects.OrderProduct dbOrderProduct = new Models.DBObjects.OrderProduct();
            if (orderProductModel != null)
            {
                dbOrderProduct.OrderID   = orderProductModel.OrderID;
                dbOrderProduct.ProductID = orderProductModel.ProductID;
                return(dbOrderProduct);
            }

            return(null);
        }
        private OrderProductModel MapDbOjectToModel(Models.DBObjects.OrderProduct dbProduct)
        {
            OrderProductModel orderProductModel = new OrderProductModel();

            if (dbProduct != null)
            {
                orderProductModel.OrderID   = dbProduct.OrderID;
                orderProductModel.ProductID = dbProduct.ProductID;

                return(orderProductModel);
            }

            return(null);
        }