Esempio n. 1
0
        static async Task MainAsync(string[] args)
        {
            try
            {
                var serviceProvider = new StartupConfigure().ConfigureServices();

                var isRunning = true;
                while (isRunning)
                {
                    Console.WriteLine("Select seed action or click any key to end");
                    Console.WriteLine("C: Create sample configuration (omitting existing parties)");
                    Console.WriteLine("D: Delete sample configuration");

                    var key = Console.ReadKey();
                    Console.WriteLine(string.Empty);
                    Console.WriteLine(string.Empty);

                    try
                    {
                        switch (char.ToLower(key.KeyChar))
                        {
                        case 'c':
                            await serviceProvider.GetService <SampleSeedLogic>().SeedAsync();

                            break;

                        case 'd':
                            await serviceProvider.GetService <SampleSeedLogic>().DeleteAsync();

                            break;

                        default:
                            Console.WriteLine("Canceled");
                            isRunning = false;
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Error: {ex.ToString()}");
                    }

                    Console.WriteLine(string.Empty);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.ToString()}");
            }
        }
Esempio n. 2
0
        static async Task MainAsync(string[] args)
        {
            try
            {
                var serviceProvider = new StartupConfigure().ConfigureServices();

                Console.WriteLine("Select seed action");
                Console.WriteLine("M: Create master tenant documents");
                Console.WriteLine("R: Add text resources");
                Console.WriteLine("P: Create passwords risk list");

                var key = Console.ReadKey();
                Console.WriteLine(string.Empty);
                Console.WriteLine(string.Empty);

                switch (char.ToLower(key.KeyChar))
                {
                case 'm':
                    await serviceProvider.GetService <MasterTenantDocumentsSeedLogic>().SeedAsync();

                    break;

                case 'r':
                    await serviceProvider.GetService <ResourceSeedLogic>().SeedAsync();

                    break;

                case 'p':
                    await serviceProvider.GetService <PasswordRiskListSeedLogic>().SeedAsync();

                    break;

                default:
                    Console.WriteLine("Canceled");
                    break;
                }

#if !DEBUG
                Console.WriteLine(string.Empty);
                Console.WriteLine("Click any key to end...");
                Console.ReadKey();
#endif
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.ToString()}");
            }
        }
Esempio n. 3
0
        static async Task MainAsync(string[] args)
        {
            try
            {
                var serviceProvider = new StartupConfigure().ConfigureServices();

                // Call sample API 1.
                // An access token is subsequently acquire using OAuth 2.0 Client Credentials Grant.
                await serviceProvider.GetService <CallApiLogic>().CallAspNetCoreApi1SampleAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"\nError: {ex}");
            }
        }
Esempio n. 4
0
        static async Task MainAsync(string[] args)
        {
            try
            {
                var serviceProvider = new StartupConfigure().ConfigureServices();

                Console.WriteLine("Select seed action");
                Console.WriteLine("P: Upload risk passwords");

                var key = Console.ReadKey();
                Console.WriteLine(string.Empty);
                Console.WriteLine(string.Empty);

                switch (char.ToLower(key.KeyChar))
                {
                case 'p':
                    await serviceProvider.GetService <RiskPasswordSeedLogic>().SeedAsync();

                    break;

                default:
                    Console.WriteLine("Canceled");
                    break;
                }

#if !DEBUG
                Console.WriteLine(string.Empty);
                Console.WriteLine("Click any key to end...");
                Console.ReadKey();
#endif
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.ToString()}");
            }
        }