Ejemplo n.º 1
0
        /// <summary>
        /// Main Method
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static async Task Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                var context  = services.GetRequiredService <JokesDbContext>();

                await JokesGenerator.Initialize(services);
            }
            host.Run();
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            JokesGenerator jokesGenerator = new JokesGenerator();
            string         randomJoke     = await jokesGenerator.GetRandomJoke();

            Console.WriteLine(randomJoke);

            string[] categories = await jokesGenerator.GetCategories();

            for (int index = categories.Length - 1; index >= 0; index--)
            {
                Console.WriteLine(categories[index]);
            }
        }
Ejemplo n.º 3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     JokesGenerator jokesGenerator = new JokesGenerator();
     string         randomJoke     = await jokesGenerator.GetRandomJoke();
 }