// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvcWithDefaultRoute(); TrainSeeder trainSeeder = new TrainSeeder(); trainSeeder.Seed(serviceProvider); RouteSeeder.AddRoutes(serviceProvider); TrainSeeder.AddTrains(serviceProvider); RolesSeeder.AddRoles(serviceProvider); RolesSeeder.AddSuperUser(serviceProvider); TrainManager tm = new TrainManager(Configuration); tm.Start(); }
// Doesn't need protection, no input is passed. public string GenerateNewTrain() { Train t = TrainSeeder.GenTrain(db); db.Trains.Add(t); db.SaveChanges(); return(t.Id); }