Exemplo n.º 1
0
        public AccountController(UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager)
        {
            _userManager   = userManager;
            _signInManager = signInManager;

            SeedIdentityData.EnsurePopulated(userManager).Wait();
        }
Exemplo n.º 2
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            SeedData.EnsurePopulated(app);
            SeedIdentityData.EnsurePopulated(app);
            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();
            app.UseStatusCodePages();

            app.UseAuthentication();

            app.UseMvcWithDefaultRoute();
        }
Exemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsProduction())
            {
                app.UseExceptionHandler("/error");
            }
            else
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
            }
            app.UseStaticFiles();
            app.UseSession();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints => {
                endpoints.MapControllerRoute("ArticleTypepage", "{ArticleType:int}/Page{ArticlePage:int}",
                                             new { Controller = "Home", action = "Index" });

                endpoints.MapControllerRoute("page", "Page{ArticlePage:int}",
                                             new { Controller = "Home", action = "Index", ArticlePage = 1 });

                endpoints.MapControllerRoute("ArticleType", "{ArticleType}",
                                             new { Controller = "Home", action = "Index", ArticlePage = 1 });

                endpoints.MapControllerRoute("pagination", "Articles/{ArticlePage:int}",
                                             new { Controller = "Home", action = "Index", ArticlePage = 1 });

                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
                endpoints.MapBlazorHub();

                endpoints.MapFallbackToPage("/admin/{*catchall}", "/Admin/Index");
            });

            SeedData.Seed(app);

            SeedIdentityData.EnsurePopulated(app);
        }