Exemplo n.º 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,
                              ILoggerFactory loggerFactory,
                              SongsSeedData songSeeder,
                              NewsSeedData newsSeeder,
                              YouTubeLinksSeedData youTubeLinksSeeder)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();

            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", action = "Index" }
                    );
            });
            songSeeder.EnsureSeedDataSongs().Wait();
            newsSeeder.EnsureSeedDataNews().Wait();
            youTubeLinksSeeder.EnsureSeedDataYouTubeLinks().Wait();
        }
Exemplo n.º 2
0
        public IActionResult News()
        {
            List <News> news = new List <News>();

            try
            {
                news = _context.NewsItems.ToList();
            }
            catch
            {
                news = NewsSeedData.GetNews();
            }
            news.Sort((x, y) => DateTime.Compare(x.Date, y.Date));

            return(PartialView(news));
        }
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.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();
            }

            NewsSeedData.EnsurePopulated(app);
            ListingsSeedData.EnsurePopulated(app);
            EventSeedData.EnsurePopulated(app);
            DonationRecordSeedData.EnsurePopulated(app);

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseStatusCodePages();
            app.UseRouting();

            app.UseAuthorization();
            app.UseAuthentication();
            app.UseMvcWithDefaultRoute();
            AppIdentityDbContext.CreateAdminAccount(app.ApplicationServices, Configuration).Wait();

            /*
             * app.UseEndpoints(endpoints =>
             * {
             *  endpoints.MapControllerRoute(
             *      name: "default",
             *      pattern: "{controller=Home}/{action=Index}/{id?}");
             * }); */
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHub <ChatHub>("/IdHome/Index");
            });

            /*app.UseSignalR(routes =>
             * {
             *  routes.MapHub<ChatHub>("/ChatHub");
             * });*/
        }