Exemple #1
0
        public void AddRecipeIngredient(int Id, IngredientDetail ingredientDetail)
        {
            RecipeIngredient recipeIngredient = new RecipeIngredient();

            recipeIngredient.Recipe           = context.Recipes.First(r => r.RecipeId == Id);
            recipeIngredient.IngredientDetail = context.IngredientDetails.First(
                igd => igd.IngredientId == ingredientDetail.IngredientId);
            recipeIngredient.Recipe.RecipeIngredients.Add(recipeIngredient);
            context.SaveChanges();
        }
Exemple #2
0
 public void DeleteRecipeIngredient(RecipeIngredient recipeIngredient)
 {
     context.RecipeIngredients.Remove(recipeIngredient);
     context.SaveChanges();
 }