Litt CodeAlong
This commit is contained in:
parent
e8146138e7
commit
9c08b65735
50
Codealong/CodeAlong0412/CodeAlong0412/App.cs
Normal file
50
Codealong/CodeAlong0412/CodeAlong0412/App.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
namespace CodeAlong0412;
|
||||
|
||||
public class App
|
||||
{
|
||||
List<Dish> _dish;
|
||||
|
||||
public App()
|
||||
{
|
||||
_dish = new List<Dish>()
|
||||
{
|
||||
new Dish("Brød", "Loff", ["Mel",]),
|
||||
new Dish("Grøt", "Rømmegrøt", ["Milk","Rømme","Ris"]),
|
||||
new Dish("Pannekaker","Pannekaker er godt", ["Milk","Mel","Egg","Sukker"]),
|
||||
};
|
||||
AppMenu();
|
||||
}
|
||||
|
||||
void AppMenu()
|
||||
{
|
||||
var running = true;
|
||||
while (running)
|
||||
{
|
||||
//Console.Clear();
|
||||
Console.WriteLine("Welcome to the Dishshower!!");
|
||||
Console.WriteLine("1. Dish List");
|
||||
var input = Console.ReadLine();
|
||||
switch(input)
|
||||
{
|
||||
case "1":
|
||||
ShowDishNames();
|
||||
Thread.Sleep(10000);
|
||||
break;
|
||||
case "2":
|
||||
//var input = Console.ReadLine();
|
||||
//SearchIngredients();
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowDishNames()
|
||||
{
|
||||
foreach (var dish in _dish)
|
||||
{
|
||||
Console.WriteLine(dish.NameOfDish);
|
||||
}
|
||||
Console.WriteLine(":-D");
|
||||
}
|
||||
}
|
|
@ -6,32 +6,8 @@
|
|||
*/
|
||||
using CodeAlong0412;
|
||||
|
||||
var dish1 = new Dish("Bread", "Loff", ["Mel","Vann","Smør"]);
|
||||
var dish2 = new Dish("Grøt","Rømmegrøt",["Ris","Rømme","Melk","Smør"]);
|
||||
var dishList = {dish1, dish2};
|
||||
new App();
|
||||
|
||||
|
||||
var running = true;
|
||||
|
||||
while (running)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("Welcome to the Dishshower!!");
|
||||
Console.WriteLine("1. Dish List");
|
||||
var input = Console.ReadLine();
|
||||
switch(input)
|
||||
{
|
||||
case "1":
|
||||
foreach (var dish in dishList)
|
||||
{
|
||||
Console.WriteLine(dish.NameOfDish);
|
||||
}
|
||||
Console.WriteLine();
|
||||
break;
|
||||
case "2":
|
||||
//var input = Console.ReadLine();
|
||||
//SearchIngredients();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class Dish
|
|||
{
|
||||
NameOfDish = name;
|
||||
DescriptionOfDish = description;
|
||||
this.Ingredients = ingredients;
|
||||
Ingredients = ingredients;
|
||||
}
|
||||
|
||||
public void ShowDish()
|
||||
|
@ -32,5 +32,4 @@ public class Dish
|
|||
|
||||
|
||||
}
|
||||
|
||||
// search
|
||||
|
|
Loading…
Reference in a new issue