// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, CSHomeworkContext cSHomeworkContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // Shows UseCors with CorsPolicyBuilder. app.UseCors(builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() ); var options = new RewriteOptions() .AddRedirectToHttps(); cSHomeworkContext.Database.Migrate(); AutoMapper.Mapper.Initialize(cfg => { cfg.CreateMap <Entities.Question, QuestionDTO>(); }); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public QuestionsController(CSHomeworkContext context) { _context = context; }
public AnswersController(CSHomeworkContext context) { _context = context; }