Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors("CorsPolicy");

            app.UseHttpsRedirection();

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            // system admin
            DataSeeder.CreateRolesAndAdmin(serviceProvider, Configuration).Wait();

            // default companies
            DataSeeder.AddDefaultAvioCompanies(serviceProvider, Configuration).Wait();
            DataSeeder.AddDefaultCarCompanies(serviceProvider, Configuration).Wait();

            // default company admins
            DataSeeder.AddDefaultAvioCompanyAdmins(serviceProvider, Configuration).Wait();
            DataSeeder.AddDefaultCarCompanyAdmins(serviceProvider, Configuration).Wait();
        }