示例#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();
            }
            app.UseSession();
            app.UseStaticFiles();

            app.UseRouting();

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

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DbObject.Initial(content);
            }
        }
示例#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)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
            app.UseEndpoints(endpoints => {
                endpoints.MapControllerRoute(
                    name: "categoryFilter",
                    pattern: "car/{action}/{category?}",
                    defaults: new { Controller = "Car", action = "List" });
            });

            using (var scope = app.ApplicationServices.CreateScope()) {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DbObjects.Initial(content);
            }
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            //app.UseMvcWithDefaultRoute();
            app.UseMvc(routes =>
            {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{Id?}");
                routes.MapRoute(name: "categoryFilter", template: "RentItem/{action}/{category?}", defaults: new { Controller = "RentItem", action = "List" });
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DbObjects.Initial(content);
            }

            //if (env.IsDevelopment())
            //{
            //    app.UseDeveloperExceptionPage();
            //}

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World on Net.Core MVC!");
            //});
        }
示例#4
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");

                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();
            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });


            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DBObjects.Initial(content);
            }
        }
示例#5
0
        public static Cart GetCartName(IServiceProvider service)
        {
            ISession     session  = service.GetRequiredService <IHttpContextAccessor>()?.HttpContext.Session;
            AppDbContent content  = service.GetRequiredService <AppDbContent>();
            string       cartName = session.GetString("cartId") ?? Guid.NewGuid().ToString();

            session.SetString("cartId", cartName);

            return(new Cart(content)
            {
                CartName = cartName
            });
        }
示例#6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();
            app.UseSession();
            app.UseMvcWithDefaultRoute();

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DbObject.Initial(content);
            }
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();
            app.UseSession();
            //app.UseMvcWithDefaultRoute();
            app.UseMvc(routes => {
                routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
                routes.MapRoute(name: "categoryFilter", template: "Car/{action}/{category?}", defaults: new { Controller = "Car", action = "List" });
            });

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DBObjects.Initial(content);
            }
        }
示例#8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            app.UseDeveloperExceptionPage(); //показывание ошибок в режиме дебага
            app.UseStatusCodePages();        //показывает код страницы
            app.UseStaticFiles();            //статические файлы, картинки и прочее
            app.UseSession();
            app.UseRouting();
            //      app.UseMvcWithDefaultRoute();// выслеживание url адрес
            app.UseMvc(routes =>
            {
                routes.MapRoute("default", "{controller=Home}/{action=Index}/{id?}");                                                                 //контроллер по умолчанию и представление по умолчанию
                routes.MapRoute(name: "categoryFilter", template: "Car/{action}/{category?}", defaults: new { Controller = "Car", action = "List" }); //известный контроллер, любое представление, передается category, в defaults по умолчанию представление
            }
                       );

            using IServiceScope score = app.ApplicationServices.CreateScope();
            AppDbContent content = score.ServiceProvider.GetRequiredService <AppDbContent>();

            DBObjects.Initial(content);
        }
示例#9
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.UseStaticFiles();
            app.UseSession();
            app.UseRouting();

            app.UseEndpoints(endpoint =>
            {
                endpoint.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                endpoint.MapControllerRoute("categoryFitler", "Phone/{action}/{category?}", defaults: new { Controller = "Phone", action = "List" });
            });

            app.UseStatusCodePages();

            using (var scope = app.ApplicationServices.CreateScope())
            {
                AppDbContent content = scope.ServiceProvider.GetRequiredService <AppDbContent>();
                DbObjects.CreateStartedTablesDb(content);
            }
        }
示例#10
0
 public OrdersRepository(AppDbContent _appDbContent, ShopCart _shopCart)
 {
     appDbContent = _appDbContent;
     shopCart     = _shopCart;
 }
示例#11
0
 public DateTempRepository(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#12
0
 public OrderRepository(AppDbContent content, Cart cart)
 {
     this.content = content;
     this.cart    = cart;
 }
示例#13
0
 public OrderController(IAllOrders allOrders, Cart cart, AppDbContent content)
 {
     this.allOrders = allOrders;
     this.cart      = cart;
     this.content   = content;
 }
 public AdminController(AppDbContent context, IWebHostEnvironment hostEnvironment)
 {
     _hostEnvironment = hostEnvironment;
     _context         = context;
 }
示例#15
0
 protected readonly AppDbContent _context;  //readonly是只读属性
 public AbstractController()
 {
     _context = new AppDbContent();
 }
示例#16
0
 public LaptopRepository(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#17
0
 public OrdersRepository(AppDbContent appDbContent, Cart cart)
 {
     this.appDbContent = appDbContent;
     this.cart         = cart;
 }
示例#18
0
 public OrderController(IAllOrders allOrders, ShopCart shopCart, AppDbContent appDbContent)
 {
     this.allOrders = allOrders;
     this.shopCart  = shopCart;
     _appDbContent  = appDbContent;
 }
示例#19
0
 public OrdersRepository(AppDbContent appDbContent, ShopCart shopCart)
 {
     _appDbContent = appDbContent;
     this.shopCart = shopCart;
 }
示例#20
0
 public AdminController(AppDbContent content, IAllCars allCars)
 {
     this.content = content;
     this.allCars = allCars;
 }
 public RentItemRepository(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
 public StoreProduct(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#23
0
 public HouseRepository(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#24
0
 public ShopCartController(IAllMotors motorcycleRep, ShopCart shopCart, AppDbContent appDbContent)
 {
     _motorcycleRep = motorcycleRep;
     _shopCart      = shopCart;
     _appDbContent  = appDbContent;
 }
示例#25
0
 public PlantDetailRepository(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#26
0
 public Cart(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#27
0
 public ShopCart(AppDbContent appDbContent)
 {
     this._appDbContent = appDbContent;
 }
示例#28
0
 public ContentRepository(AppDbContent appDBContent)
 {
     this.appDBContent = appDBContent;
 }
 public CategoryRepository(AppDbContent appDbContent)
 {
     this.appDbContent = appDbContent;
 }
示例#30
0
 public OrdersRepository(AppDbContent appDbContent, ShopCar shopCar)
 {
     this.appDbContent = appDbContent;
     this.shopCar      = shopCar;
 }