diff --git a/Codealong/CodeAlong0412/CodeAlong0412/App.cs b/Codealong/CodeAlong0412/CodeAlong0412/App.cs index 83004a3..32d9a65 100644 --- a/Codealong/CodeAlong0412/CodeAlong0412/App.cs +++ b/Codealong/CodeAlong0412/CodeAlong0412/App.cs @@ -41,9 +41,9 @@ public class App { Console.Clear(); Console.WriteLine("Velkommen til Oppskrifts appen: "); - Console.WriteLine("1. Vis liste over alle oppskriftene"); - Console.WriteLine("2. Søk på ingrediens"); - Console.WriteLine("3. Søk på kategori"); + Console.WriteLine("1.) Vis liste over alle oppskriftene:"); + Console.WriteLine("2.) Filtrer på kategori"); + Console.WriteLine("3.) Filtrer på ingrdiensene"); Console.WriteLine("q. for å avslutte"); @@ -53,11 +53,11 @@ public class App case "1": ShowDishNamesMenu(); break; - case "2": - ShowDishByIngredientsMenu(); + case "2": + ShowDishCategoryMenu(); break; case "3": - ShowDishByCategoryMenu(); + ShowIngredientsMenu(); break; case "q": running = false; @@ -90,7 +90,39 @@ public class App var thisDish = Dish.FirstOrDefault(d => d.DishId == id); Console.WriteLine($"Navn: {thisDish.NameOfDish}\nBeskrivelse: {thisDish.DescriptionOfDish}"); Console.ReadLine(); - } + } + + public void ShowIngredientsMenu() + { + Console.Clear(); + Console.WriteLine("Filtrer basert på ingrediens: "); + var search = Console.ReadLine(); + var dishes = Dish.Where(d => d.Ingredients.Contains(search)); + Console.WriteLine($"Retter med {search}"); + foreach (var dish in dishes) + { + Console.WriteLine($"{dish.NameOfDish} - {dish.DescriptionOfDish}"); + } + Console.WriteLine("Trykk for å gå tilbake"); + Console.ReadKey(); + + } + + void ShowDishCategoryMenu() + { + Console.Clear(); + Console.WriteLine("Filtre basert på kategori: "); + Console.WriteLine("Kategorier: Middag - Forkost - Lunsj - Dessert - Bakverk"); + var input = Console.ReadLine(); + var dish = Dish.Where(d => d.Categories.Contains(input)); + Console.WriteLine($"Retter i {input} kategorien"); + foreach (var d in dish) + { + Console.WriteLine($"{d.NameOfDish} - {d.DescriptionOfDish}"); + } + + Console.ReadKey(); + } } diff --git a/Codealong/CodeAlong0412/CodeAlong0412/recepies.cs b/Codealong/CodeAlong0412/CodeAlong0412/recepies.cs index 9ef9307..a4fb788 100644 --- a/Codealong/CodeAlong0412/CodeAlong0412/recepies.cs +++ b/Codealong/CodeAlong0412/CodeAlong0412/recepies.cs @@ -32,7 +32,7 @@ public class Dish } ; return items; } - public void ShowDishByIngredientsMenu() + public void ShowDishByIngredients() { Console.Clear(); Console.WriteLine("Tilgjengelige ingredienter: "); diff --git a/Emne 3/PokemonMarie/PokemonMarie.sln b/Emne 3/PokemonMarie/PokemonMarie.sln new file mode 100644 index 0000000..68c2a29 --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PokemonMarie", "PokemonMarie\PokemonMarie.csproj", "{10578A67-5571-4BDE-852C-ECD52CDBFDCA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {10578A67-5571-4BDE-852C-ECD52CDBFDCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10578A67-5571-4BDE-852C-ECD52CDBFDCA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10578A67-5571-4BDE-852C-ECD52CDBFDCA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10578A67-5571-4BDE-852C-ECD52CDBFDCA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Emne 3/PokemonMarie/PokemonMarie/PokeGym.cs b/Emne 3/PokemonMarie/PokemonMarie/PokeGym.cs new file mode 100644 index 0000000..5bd9ed6 --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/PokeGym.cs @@ -0,0 +1,6 @@ +namespace PokemonMarie; + +public class PokeGym +{ + +} \ No newline at end of file diff --git a/Emne 3/PokemonMarie/PokemonMarie/PokeShop.cs b/Emne 3/PokemonMarie/PokemonMarie/PokeShop.cs new file mode 100644 index 0000000..caf7243 --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/PokeShop.cs @@ -0,0 +1,6 @@ +namespace PokemonMarie; + +public class PokeShop +{ + +} \ No newline at end of file diff --git a/Emne 3/PokemonMarie/PokemonMarie/Pokemon.cs b/Emne 3/PokemonMarie/PokemonMarie/Pokemon.cs new file mode 100644 index 0000000..b233b4c --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/Pokemon.cs @@ -0,0 +1,8 @@ +namespace PokemonMarie; + +public class Pokemon +{ + int Levet { get; set; } + string Type { get; set; } + string Name { get; set; } +} \ No newline at end of file diff --git a/Emne 3/PokemonMarie/PokemonMarie/PokemonMarie.csproj b/Emne 3/PokemonMarie/PokemonMarie/PokemonMarie.csproj new file mode 100644 index 0000000..2f4fc77 --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/PokemonMarie.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Emne 3/PokemonMarie/PokemonMarie/PokemonWorld.cs b/Emne 3/PokemonMarie/PokemonMarie/PokemonWorld.cs new file mode 100644 index 0000000..79fb85b --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/PokemonWorld.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.Design; + +namespace PokemonMarie; + +public class PokemonWorld +{ + public Trainer MyTrainer { get; set; } + public Pokemon StartPokemon { get; set; } + public List WildPokemons { get; set; } + + public PokemonWorld() + { + MyTrainer = new Trainer("Ash"); + WildPokemons = new List() + { + new Pokemon(), + new Pokemon() + }; + Menu(); + } + + public void Menu() + { + Console.WriteLine("Welcome to Pokemon"); + } +} \ No newline at end of file diff --git a/Emne 3/PokemonMarie/PokemonMarie/Program.cs b/Emne 3/PokemonMarie/PokemonMarie/Program.cs new file mode 100644 index 0000000..0ea387b --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/Program.cs @@ -0,0 +1,23 @@ +// Pokemon + // Stats - Level + // Type + // Name + +// Trainer + // Pokemon[] + // List Inventory + // currentPokemon + // GoToWilderness() + // BattlePokemon() + // CatchPokemon() + // EnterStore() + // BuyItem(string itemType) +// Pokemonworld + // List WildPokemon + // GetRandomPokemon(string type) +// PokemonShop + // List StoreInventory +// PokeGym + // GymTrainer + + diff --git a/Emne 3/PokemonMarie/PokemonMarie/Trainer.cs b/Emne 3/PokemonMarie/PokemonMarie/Trainer.cs new file mode 100644 index 0000000..8bac23a --- /dev/null +++ b/Emne 3/PokemonMarie/PokemonMarie/Trainer.cs @@ -0,0 +1,7 @@ +namespace PokemonMarie; + +internal class Trainer +{ + public List Inventory { get; set; } + public Pokemon Pokemon { get; private set; } +} \ No newline at end of file