Esempio 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();
        }
        public JsonResult GetYouTubeLinks()
        {
            _allYouTubeLinks = new List <YouTubeLink>();


            try
            {
                _allYouTubeLinks = _context.YouTubeLinks.ToList();
            }
            catch
            {
                _allYouTubeLinks = YouTubeLinksSeedData.GetYouTubeLinks();
            }

            return(new JsonResult(_allYouTubeLinks));
        }