Пример #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)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                // seed the database at startup
                StudentServiceSeeder.Seed(new StudentService());
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            // ** Enable site Authentication/Authorization **
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Пример #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebAssemblyDebugging(); // blazor

                StudentServiceSeeder.Seed(new StudentService());
            }

            app.UseHttpsRedirection();

            app.UseBlazorFrameworkFiles(); // blazor
            app.UseStaticFiles();          // blazor

            app.UseRouting();

            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            app.UseAuthentication(); // Must be after UseRouting()
            app.UseAuthorization();  // Must be after UseAuthentication()

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapFallbackToFile("index.html");   // blazor
            });
        }
Пример #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                StudentServiceSeeder.Seed(new StudentService());
            }

            app.UseHttpsRedirection();

            app.UseRouting();
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Пример #4
0
        public void CloseTicket_ForAlreadyClosedTicket_ShouldReturnNull()
        {
            // arrange
            StudentServiceSeeder.Seed(svc);

            // get first open tickets and check some exist
            var tickets = svc.GetActiveTickets();

            Assert.NotEmpty(tickets);
            // close first ticket
            var ticket = svc.CloseTicket(tickets[0].Id);

            // act
            var closed = svc.CloseTicket(ticket.Id);

            // assert
            Assert.Null(closed);
        }
Пример #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                // seed the database at startup
                StudentServiceSeeder.Seed(new StudentService());
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            //app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            // ** Enable site Authentication **
            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                // custom route
                //routes.MapRoute(
                //    name: "search",
                //    template: "search/{name?}",
                //    defaults: new { Controller = "Student", Action = "Search"}
                //);
                // default route tempate
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }