Beispiel #1
0
 public ForumController(IPostService postService, ICommentService commentService, WhatGenreContext context, UserManager <User> userManager)
 {
     this.context        = context;
     this.postService    = postService;
     this.commentService = commentService;
     this.userManager    = userManager;
 }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, WhatGenreContext context)
        {
            //context.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                //app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

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

            // add home area and map route

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
                endpoints.MapAreaControllerRoute(
                    name: "ForumArea",
                    areaName: "Forum",
                    pattern: "Forum/{controller=Forum}/{action=Index}/{id?}");
                endpoints.MapAreaControllerRoute(
                    name: "StoreArea",
                    areaName: "Store",
                    pattern: "Store/{controller=Store}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });
        }