private static void ShowJoke() { Console.WriteLine("Number?"); string index = Console.ReadLine(); int jokeId; bool isNumber = int.TryParse(index, out jokeId); if (isNumber) { Joke joke = _service.GetJokeById(jokeId); if (joke != null) { Console.WriteLine($"({joke.Id}) - {joke.Title}"); Console.WriteLine($"{joke.Question}"); Console.WriteLine($"{joke.Answer}"); Console.WriteLine("-----------------------"); Console.WriteLine("Please enter a command: "); Console.WriteLine("1) Edit"); Console.WriteLine("2) Delete"); Console.WriteLine("Any key to return to menu"); string command = Console.ReadLine(); switch (command) { case "1": EnterJoke(joke); break; case "2": DeleteJoke(joke.Id); break; } } else { Console.WriteLine("Joke not found"); } } else { Console.WriteLine("Joke not found"); } }
public Joke GetJokeById(int jokeId) { return(_serviceClient.GetJokeById(jokeId)); }