public void UpdateIngredientDetail(IngredientDetail ingredientDetail)
        {
            IngredientDetail dbIngredientDetail = context.IngredientDetails.First(id => id.IngredientId == ingredientDetail.IngredientId);

            dbIngredientDetail.IngredientId     = ingredientDetail.IngredientId;
            dbIngredientDetail.IngredientString = ingredientDetail.IngredientString;

            context.SaveChanges();
        }
Ejemplo n.º 2
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();
        }
 public void DeleteIngredientDetail(IngredientDetail ingredientDetail)
 {
     context.IngredientDetails.Remove(ingredientDetail);
     context.SaveChanges();
 }
 public void AddIngredientDetail(IngredientDetail ingredientDetail)
 {
     context.IngredientDetails.Add(ingredientDetail);
     context.SaveChanges();
 }