public int UpdateOrderItems(int orderItemID, OrderItemModel orderItem) { string query = @"UPDATE [CoroNacessitiesDB].dbo.OrderItem SET OrderItemID = @OrderItemID, OrderID = @OrderID, ProductID = @ProductID, NoOfProducts = @NoOfProducts WHERE OrderItemID = @OrderItemID"; return(CoroNacessitiesDBContext.getConnection().Execute(query, new { OrderItemID = orderItem.orderItemID, OrderID = orderItem.orderID, ProductID = orderItem.productID, NoOfProducts = orderItem.noOfProducts })); }
// Order Items public int AddOrderItems(OrderItemModel orderItem) { string query = @"INSERT INTO [CoroNacessitiesDB].dbo.OrderItem (OrderID, ProductID, NoOfProducts) VALUES (@OrderID, @ProductID, @NoOfProducts)"; return(CoroNacessitiesDBContext.getConnection().Execute(query, new { OrderID = orderItem.orderID, ProductID = orderItem.productID, NoOfProducts = orderItem.noOfProducts })); }