using ConsoleApp.Menu.Core; using Model; using Model.Managers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp.Menu { internal class AddRecipeMenu : Entry { MasterManager masterMgr; public AddRecipeMenu(MasterManager masterManager) : base("Add recipe", new Entry.EntryStep("Title: ", typeof(string)), new Entry.EntryStep("Step 1: ", typeof(string)), new Entry.EntryStep("Step 2: ", typeof(string)), new Entry.EntryStep("Step 3: ", typeof(string)), new Entry.EntryStep("Step 4: ", typeof(string))) { masterMgr = masterManager; } public override IMenu? Return() { string title = _selectList[0].Item.Input; PreparationStep[] steps = new PreparationStep[4]; for (int i = 0; i < 4; i++) steps[i] = new PreparationStep(i+1, _selectList[i].Item.Input); Recipe recipe = new Recipe(title, steps); masterMgr.DataMgr.Data[nameof(Recipe)].Add(recipe); return null; } } }