/// <summary>Takes a model generated from the modeling engine and loads necessary data from the database to deliver relevance to a user interface.</summary> /// <param name="model">Model from modeling engine</param> /// <returns>CompiledModel object which contains full recipe information about the provided set.</returns> public CompiledModel Compile(Model model) { var results = new CompiledModel(); var recipes = context.ReadRecipes(model.RecipeIds, ReadRecipeOptions.None); results.RecipeIds = model.RecipeIds; results.Pantry = model.Pantry; results.Briefs = recipes.Select(r => { return(new RecipeBrief(r)); }).ToArray(); results.Recipes = recipes.Select(r => new SuggestedRecipe { Id = r.Id, Ingredients = context.AggregateRecipes(r.Id).ToArray() }).ToArray(); return(results); }
/// <summary>Takes a model generated from the modeling engine and loads necessary data from the database to deliver relevance to a user interface.</summary> /// <param name="model">Model from modeling engine</param> /// <returns>CompiledModel object which contains full recipe information about the provided set.</returns> public CompiledModel Compile(Model model) { var results = new CompiledModel(); var recipes = context.ReadRecipes(model.RecipeIds, ReadRecipeOptions.None); results.RecipeIds = model.RecipeIds; results.Pantry = model.Pantry; results.Briefs = recipes.Select(r => { return new RecipeBrief(r); }).ToArray(); results.Recipes = recipes.Select(r => new SuggestedRecipe { Id = r.Id, Ingredients = context.AggregateRecipes(r.Id).ToArray() }).ToArray(); return results; }