private static void ProcessInput(char keyPressed) { switch (keyPressed) { case 'L': { var ds = new JokeDataService(); var resultObject = ds.GetAllJokes(); foreach (Joke j in resultObject) { Console.WriteLine($"ID: {j.JokeId}"); Console.WriteLine($"Title: {j.Title}"); Console.WriteLine($"Joke: {j.JokeText}"); } break; } case 'N': { Joke j = new Joke(); Console.WriteLine("Title...."); j.Title = Console.ReadLine(); Console.WriteLine("Joke Text...."); j.JokeText = Console.ReadLine(); var ds = new JokeDataService(); var response = ds.AddJoke(j); Console.WriteLine("Joke Added:"); Console.WriteLine($"ID: {response.JokeId}"); Console.WriteLine($"Title: {response.Title}"); Console.WriteLine($"Joke: {response.JokeText}"); break; } } }
private static void ProcessInput(char keyPressed) { switch (keyPressed) { case 'L': { JokeDataService jds = new JokeDataService(); List <Joke> l = jds.GetAllJokes(); foreach (Joke j in l) { Console.WriteLine($"ID: {j.JokeId}"); Console.WriteLine($"Title: {j.Title}"); Console.WriteLine($"Joke: {j.JokeText}"); } break; } case 'N': { break; } } }