本文整理汇总了C#中KitchenPC.Recipes.Recipe.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Recipe.Select方法的具体用法?C# Recipe.Select怎么用?C# Recipe.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KitchenPC.Recipes.Recipe
的用法示例。
在下文中一共展示了Recipe.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateShoppingList
/// <summary>
/// Creates a new shopping list for the current user.
/// </summary>
/// <param name="name">The name of the new shopping list.</param>
/// <param name="recipes">Zero or more recipes to add to this list.</param>
/// <param name="ingredients">Zero or more ingredients to add to this list.</param>
/// <param name="usages">Zero or more ingredient usages to add to this list.</param>
/// <param name="items">Zero or more raw usages. Raw usages will be parsed using NLP, and unsuccessful matches will be added to the list as raw items.</param>
/// <returns>A fully aggregated shopping list, with like items combined and forms normalized.</returns>
public virtual ShoppingListResult CreateShoppingList(
string name,
Recipe[] recipes,
Ingredient[] ingredients,
IngredientUsage[] usages,
string[] items)
{
var parsedIngredients = Parser.ParseAll(items).ToList();
var recipeAggregation = this.AggregateRecipes(recipes.Select(r => r.Id).ToArray());
var ingredientsAggregation = ingredients.Select(i => new IngredientAggregation(i, null));
var ingredientUsages = this.AggregateIngredients(usages);
var parsedUsages = this.AggregateIngredients(parsedIngredients.Where(u => u is Match).Select(u => u.Usage).ToArray());
var rawInputs = parsedIngredients.Where(u => u is NoMatch).Select(u => new ShoppingListItem(u.Input));
var allItems = recipeAggregation
.Concat(ingredientsAggregation)
.Concat(ingredientUsages)
.Concat(parsedUsages)
.Concat(rawInputs);
var list = new ShoppingList(null, name, allItems);
return this.CreateShoppingList(list);
}