Example #1
0
 public void Update(string name, string description, RecipeInfo info, IEnumerable <RecipeIngredient> ingredients)
 {
     Name              = SetName(name);
     Description       = SetDescription(description);
     RecipeInfo        = info;
     RecipeIngredients = new RecipeIngredientsCollection(ingredients);
     Update();
 }
Example #2
0
            public async Task <Recipe> Create(Guid id,
                                              string name,
                                              string description,
                                              string imageUrl,
                                              RecipeInfo recipeInfo,
                                              IEnumerable <RecipeIngredient> recipeIngredients)
            {
                var recipe = GetRecipe(id, name, description, imageUrl, recipeInfo, recipeIngredients);
                await recipe.Create();

                return(recipe);
            }
Example #3
0
 private Recipe(Identity <Guid> id,
                string name,
                string description,
                string imageUrl,
                RecipeInfo recipeInfo,
                IEnumerable <RecipeIngredient> recipeIngredients,
                IEventPublisher eventPublisher,
                IRecipeRepository recipeRepository)
 {
     Id                = id;
     Name              = SetName(name);
     Description       = SetDescription(description);
     ImageUrl          = imageUrl;
     RecipeInfo        = recipeInfo;
     RecipeIngredients = new RecipeIngredientsCollection(recipeIngredients);
     _eventPublisher   = eventPublisher;
     _recipeRepository = recipeRepository;
 }
Example #4
0
            public Recipe GetRecipe(Guid id,
                                    string name,
                                    string description,
                                    string imageUrl,
                                    RecipeInfo recipeInfo,
                                    IEnumerable <RecipeIngredient> recipeIngredients)
            {
                var recipeId = new Identity <Guid>(id);
                var recipe   = new Recipe(recipeId,
                                          name,
                                          description,
                                          imageUrl,
                                          recipeInfo,
                                          recipeIngredients,
                                          _eventPublisher,
                                          _recipeRepository);

                return(recipe);
            }
 public static RecipeInfo FromDomainRecipeInfo(Domain.Recipes.Entities.RecipeInfo recipeInfo) =>
 new RecipeInfo(recipeInfo.DifficultyLevel, recipeInfo.PreparationTime, recipeInfo.ApproximateCost, recipeInfo.Servings, recipeInfo.MealTypes);