public void order(int dishNum, MenuExplorer menu) { if (menu.decIngred(dishNum)) { Console.WriteLine($"Success!, your {Menu.Dishes[dishNum-1]} is ready"); } else { Console.WriteLine("Not enough ingridients"); } }
private int msgParser(string msg, DateTime time, MenuExplorer menu) { int num = int.Parse(msg); if (num > menu.getMenu(time).Dishes.Count || num < 0) { throw new ArgumentException(); } else { return(num); } }
public void callMenu(DateTime time, MenuExplorer menu) { Console.WriteLine("Menu"); int iter = 1; Menu = menu.getMenu(time); foreach (Dish dish in Menu.Dishes) { Console.WriteLine($"{iter}. {dish}"); iter++; } Console.WriteLine("0. Refresh"); }
public void readOrder(DateTime time, OutputService output, MenuExplorer menu) { Console.WriteLine("Choose dish number to order: "); string mesg = Console.ReadLine(); try { int inpNum = msgParser(mesg, time, menu); //Console.WriteLine(inpNum); if (inpNum != 0) { output.order(inpNum, menu); } }catch (Exception) { Console.WriteLine("Wrong format"); } }
public MenuService() { _model = new MenuExplorer(); }