// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, SchoolDiaryDbContext dataContext) { app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "School Diary API V1"); options.RoutePrefix = string.Empty; }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } dataContext.Database.EnsureCreated(); app.UseCors(options => options.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hello World!"); }); }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public StudentsController(SchoolDiaryDbContext dataContext, IMapper mapper) { _dataContext = dataContext; _mapper = mapper; }
public TeachersController(SchoolDiaryDbContext dataContext, IMapper mapper) { _dataContext = dataContext; _mapper = mapper; }