// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, FactoryContext factoryContext) { //app.UseStaticFiles(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Vandelay API v1"); }); } else { app.UseExceptionHandler(appBuilder => { appBuilder.Run(async context => { context.Response.StatusCode = 500; await context.Response.WriteAsync("An unexpected error has occured. Try again Later."); }); }); } //app.UseSwaggerUI(c => //{ // c.SwaggerEndpoint("/swagger/v1/swagger.json", "Vandelay API v1"); //}); //app.UseHttpsRedirection(); AutoMapper.Mapper.Initialize(cfg => { cfg.CreateMap <Entities.Factory, Models.FactoryDto>(); //.ForMember(dest => dest.FactoryAddress, // opt => opt.MapFrom(src => // $"{src.FactoryAddress.BuildingName}, {src.FactoryAddress.StreetLine1}, {src.FactoryAddress.StreetLine2}, {src.FactoryAddress.City}, {src.FactoryAddress.StateProvince}, {src.FactoryAddress.ZipPostalCode}, {src.FactoryAddress.Country}")); cfg.CreateMap <Entities.Machine, Models.MachineDto>(); }); factoryContext.SeedDataForFactoryContext(); app.UseMvc(); }