public void AddRecipeIngredientsToShoppingList(Guid recipeId, int numberOfPersons, Guid shoppingListId, bool onlyUnavailable) { var recipe = recipeAdapter.GetRecipeById(recipeId); foreach (var ingredient in recipe.Ingredients) { var request = new AddProductToShoppingListRequest { MeasurementAmount = ingredient.UnitQuantity * numberOfPersons, MeasurementType = ingredient.UnitQuantityType, NrOfPersons = numberOfPersons, ProductId = ingredient.ProductId, Reason = EShoppingListReason.Recipe, RecipeId = recipeId, RecipeOnlyAvailable = onlyUnavailable }; myShoppingListService.AddProductToShoppingList(shoppingListId, request); } }
public void Post(Guid shoppingListID, [FromBody] AddProductToShoppingListRequest request) { myShoppingListService.AddProductToShoppingList(shoppingListID, request); }