Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, UserManager <MyMeetupUser> userManager,
                              RoleManager <MyMeetupRole> roleManager, MyMeetupContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                //   app.UseDeveloperExceptionPage();
                //  app.UseDatabaseErrorPage();
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            // app.UseDeveloperExceptionPage();
            var supportedCultures = new List <CultureInfo>
            {
                new CultureInfo("fr"),
                new CultureInfo("fr-FR"),
                //new CultureInfo("en"),
                //new CultureInfo("en-US")
            };

            var localizationOptions = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("fr-FR"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures
            };

            app.UseRequestLocalization(localizationOptions);
            app.UseElmah();
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            context.Database.Migrate();
            app.UseAuthentication();
            Seeding.SeedRoles(roleManager);
            Seeding.SeedUsers(userManager);
            Seeding.SeedData(context);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "areas",
                    template: "{area:exists}/{controller=Home}/{action=Index}"
                    );
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Пример #2
0
 private void fullResetToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Seeding.SeedUsers();
     Seeding.SeedUrls();
 }