// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, WorldContextSeedData seeder, ILoggerFactory factory) { Mapper.Initialize(config => { config.CreateMap <TripViewModel, Trip>().ForMember(dest => dest.DateCreated, opt => opt.MapFrom(src => src.Created)).ReverseMap(); config.CreateMap <StopViewModel, Stop>().ReverseMap(); config.CreateMap <CreateUserViewModel, User>() .ForMember(d => d.IsNotificationsAllowed, opt => opt.MapFrom(src => src.AllowNotifications)) .ForMember(d => d.PhoneNumber, opt => opt.MapFrom(src => src.Phone)) .ReverseMap(); config.CreateMap <UserInfoViewModel, User>() .ForMember(d => d.IsNotificationsAllowed, opt => opt.MapFrom(src => src.AllowNotifications)) .ForMember(d => d.PhoneNumber, opt => opt.MapFrom(src => src.Phone)).ReverseMap(); }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); factory.AddDebug(LogLevel.Information); } else { factory.AddDebug(LogLevel.Error); } app.UseAuthentication(); app.UseStaticFiles(); app.UseMvc(config => { config.MapRoute( name: "Default", template: "{controller}/{action}/{id?}", defaults: new { controller = "App", action = "Index" } ); }); seeder.SeedUsers().Wait(); seeder.EnsureSeedData().Wait(); }