public static Product AddProductToGroceryList(Product product, Account account, GroceryList groceries) { using (OracleConnection connection = Connection) { try { OracleCommand command = CreateOracleCommand(connection, "Insert INTO BOODSCHAPPENLIJST_PRODUCTEN(BOODSCHAPPENLIJST_ID, PRODUCT_ID, GEBRUIKER_ID) VALUES(:groceriesID, :productID, :accountID"); command.Parameters.Add(":groceriesID", groceries.ID); command.Parameters.Add(":productID", product.ID); command.Parameters.Add(":accountID", account.ID); command.ExecuteNonQuery(); return product; } catch { return null; } finally { connection.Close(); } } }
public static Product AddProductToGroceryList(Product product, Account account, GroceryList groceries) { using (OracleConnection connection = Connection) { try { OracleCommand command = CreateOracleCommand(connection, "Insert INTO BOODSCHAPPENLIJST_PRODUCTEN(BOODSCHAPPENLIJST_ID, PRODUCT_ID, GEBRUIKER_ID) VALUES(:groceriesID, :productID, :accountID"); command.Parameters.Add(":groceriesID", groceries.ID); command.Parameters.Add(":productID", product.ID); command.Parameters.Add(":accountID", account.ID); command.ExecuteNonQuery(); return(product); } catch { return(null); } finally { connection.Close(); } } }