public async Task Handle(IngredientUpdatedEvent @event) { var recipesIds = await _recipeDetailsRepository.GetRecipeIdsByIngredientId(@event.IngredientId); var recipeDetailsCollection = new List <RecipeDetails>(); foreach (var recipesId in recipesIds) { var recipeDetails = await _recipeDetailsFactory.Create(recipesId); recipeDetailsCollection.Add(recipeDetails); } await _recipeDetailsRepository.CreateNewOrReplaceExistingRange(recipeDetailsCollection); }
private async Task Build() { var recipesIds = await _recipeDetailsRepository.GetAllRecipesIds(); var recipeDetailsCollection = new List <RecipeDetails>(); foreach (var recipesId in recipesIds) { var recipeDetails = await _recipeDetailsFactory.Create(recipesId); recipeDetailsCollection.Add(recipeDetails); } await _recipeDetailsRepository.CreateNewOrReplaceExistingRange(recipeDetailsCollection); }