Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, VolvoTruckContext dbContext)
        {
            if (env.IsDevelopment())
            {
                dbContext.Database.Migrate();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Trucks}/{action=Index}/{id?}");
            });
        }
Example #2
0
 public TruckModelRepository(VolvoTruckContext ctx)
 {
     _ctx = ctx;
 }