// 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 GetLoopSongs() { _allSongs = new List <Song>(); try { _allSongs = _context.Songs.ToList(); } catch { _allSongs = SongsSeedData.GetSongs(); } return(new JsonResult(_allSongs)); }