public void updateAllTables(Ingredient i, Recipe r) { var dbRecipes = new DatabaseAccessRecipe(); var dbIngredients = new DatabaseAccessIngredient(); var dbConsumptionOuncesConsumed = new DatabaseAccessConsumptionOuncesConsumed(); var dbConsumption = new DatabaseAccessConsumption(); var dbDensities = new DatabaseAccessDensities(); var dbDensityInformation = new DatabaseAccessDensityInformation(); var dbCosts = new DatabaseAccessCosts(); var myCostTable = dbCosts.queryCostTable(); foreach (var ingredient in myCostTable) { if (ingredient.ingredientId == i.ingredientId) { if (ingredient.sellingPrice == 0m && i.sellingPrice != 0m) { dbCosts.updateCostDataTable(i); break; } } } dbRecipes.UpdateRecipe(r); dbIngredients.UpdateIngredient(i); var updatedIngredient = queryAllRelevantTablesSQLByIngredientName(i); dbDensityInformation.updateDensityInfoTable(i); dbDensities.updateDensityTable(i); dbCosts.updateCostDataTable(i); }
public void insertListOfIngredientsIntoAllTables(List <Ingredient> ListOfIngredients, Recipe r) { var dbR = new DatabaseAccessRecipe(); foreach (var ingredient in ListOfIngredients) { insertIngredientIntoAllTables(ingredient, r); } dbR.UpdateRecipe(r); var myIngredientsSecond = queryAllTablesForAllIngredients(ListOfIngredients); }