You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Model;
|
|
|
|
namespace ConsoleApp.Menu
|
|
{
|
|
/// <summary>
|
|
/// An utility to find a recipe.
|
|
/// </summary>
|
|
internal class SearcherRecipe : Menu<Recipe>
|
|
{
|
|
public SearcherRecipe() : base("Search recipe")
|
|
{
|
|
|
|
}
|
|
|
|
public static SearcherRecipe SearchInRecipeCollection(string title, RecipeCollection recipeCollection)
|
|
{
|
|
Dictionary<Recipe, string> recipesSelectors = new Dictionary<Recipe, string>();
|
|
foreach (Recipe recipe in recipeCollection)
|
|
{
|
|
recipesSelectors.Add(recipe, recipe.Title);
|
|
}
|
|
return new SearcherRecipe(title, CreateSelection(recipesSelectors));
|
|
}
|
|
|
|
#region Methodes
|
|
public override void Return()
|
|
{
|
|
Console.WriteLine(CurrentSelected);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|