Super dirty codealong app

This commit is contained in:
Geir Okkenhaug Jerstad 2024-12-05 18:40:03 +01:00
parent 9aecbbd1b1
commit 4f8b991da6
10 changed files with 142 additions and 8 deletions

View file

@ -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();
}
}

View file

@ -32,7 +32,7 @@ public class Dish
} ;
return items;
}
public void ShowDishByIngredientsMenu()
public void ShowDishByIngredients()
{
Console.Clear();
Console.WriteLine("Tilgjengelige ingredienter: ");

View file

@ -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

View file

@ -0,0 +1,6 @@
namespace PokemonMarie;
public class PokeGym
{
}

View file

@ -0,0 +1,6 @@
namespace PokemonMarie;
public class PokeShop
{
}

View file

@ -0,0 +1,8 @@
namespace PokemonMarie;
public class Pokemon
{
int Levet { get; set; }
string Type { get; set; }
string Name { get; set; }
}

View file

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View file

@ -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<Pokemon> WildPokemons { get; set; }
public PokemonWorld()
{
MyTrainer = new Trainer("Ash");
WildPokemons = new List<Pokemon>()
{
new Pokemon(),
new Pokemon()
};
Menu();
}
public void Menu()
{
Console.WriteLine("Welcome to Pokemon");
}
}

View file

@ -0,0 +1,23 @@
// Pokemon
// Stats - Level
// Type
// Name
// Trainer
// Pokemon[]
// List<string> Inventory
// currentPokemon
// GoToWilderness()
// BattlePokemon()
// CatchPokemon()
// EnterStore()
// BuyItem(string itemType)
// Pokemonworld
// List<Pokemon> WildPokemon
// GetRandomPokemon(string type)
// PokemonShop
// List<string> StoreInventory
// PokeGym
// GymTrainer

View file

@ -0,0 +1,7 @@
namespace PokemonMarie;
internal class Trainer
{
public List<string> Inventory { get; set; }
public Pokemon Pokemon { get; private set; }
}