当前位置: 首页>>代码示例>>C#>>正文


C# Recipe.Select方法代码示例

本文整理汇总了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);
        }
开发者ID:Derneuca,项目名称:KitchenPCTeamwork,代码行数:33,代码来源:DBContext.cs


注:本文中的KitchenPC.Recipes.Recipe.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。