Ejemplo n.º 1
0
    public void AddRecipeWithIngredients(RecipeWithIngredients recipeWithIngredients, string userId)
    {
        Recipe recipe = recipeWithIngredients.Recipe;

        recipe.UserId = userId;
        AddRecipe(recipe);
        foreach (Ingredient ingredient in recipeWithIngredients.Ingredients)
        {
            ingredient.RecipeId = recipeWithIngredients.Recipe.Id;
            _ingredientsRepository.PostIngredient(ingredient);
        }
    }
Ejemplo n.º 2
0
        public MyResponse AddIngredient(Ingredient ingredient, string userId)
        {
            MyResponse validateResult = ValidateAddIngredient(ingredient, userId);

            if (validateResult.IsSuccess())
            {
                _ingredientsRepository.PostIngredient(ingredient);
            }
            return(validateResult);
        }