// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, WorldCupContext worldCupContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } // Seed DB worldCupContext.DataSeed(); // Configure API app.UseHttpsRedirection(); app.UseExceptionHandlerWithProblemJson(); app.UseMvc(); app.UseOpenApi(); // Configure Automapper app.UseAutoMapper(mapperConfig => { mapperConfig.CreateMap <Entities.Team, Models.TeamDto>(); mapperConfig.CreateMap <Entities.Team, Models.TeamDetailsDto>(); mapperConfig.CreateMap <Entities.Player, Models.PlayerDto>(); mapperConfig.CreateMap <Models.PlayerDto, Entities.Player>(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, WorldCupContext worldCupContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } // Seed DB worldCupContext.DataSeed(); // Configure API app.UseHttpsRedirection(); app.UseExceptionHandlerWithProblemJson(); app.UseStatusCodePagesWithReExecute("/errors/{0}"); app.UseMvc(); app.UseOpenApi(); // Configure Automapper AutoMapperConfig.Initialize(); }