Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, HogwartsDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler(appBuilder =>
                {
                    appBuilder.Run(async context =>
                    {
                        context.Response.StatusCode = 500;
                        await context.Response.WriteAsync($"An unexpected fault happened. Try again later, Mista");
                    });
                });
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
 public CourseRepository(HogwartsDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
 public StudentRepository(HogwartsDbContext context, IMapper mapper)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Beispiel #4
0
 public RoleRepository(HogwartsDbContext context)
 {
     _context = context;
 }
 public StaffRepository(HogwartsDbContext context)
 {
     _context = context;
 }