// 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); } }
// 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!"); //}); }
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); } }
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 }); }
// 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); } }
// 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); }
// 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); } }
public OrdersRepository(AppDbContent _appDbContent, ShopCart _shopCart) { appDbContent = _appDbContent; shopCart = _shopCart; }
public DateTempRepository(AppDbContent appDbContent) { this.appDbContent = appDbContent; }
public OrderRepository(AppDbContent content, Cart cart) { this.content = content; this.cart = cart; }
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; }
protected readonly AppDbContent _context; //readonly是只读属性 public AbstractController() { _context = new AppDbContent(); }
public LaptopRepository(AppDbContent appDbContent) { this.appDbContent = appDbContent; }
public OrdersRepository(AppDbContent appDbContent, Cart cart) { this.appDbContent = appDbContent; this.cart = cart; }
public OrderController(IAllOrders allOrders, ShopCart shopCart, AppDbContent appDbContent) { this.allOrders = allOrders; this.shopCart = shopCart; _appDbContent = appDbContent; }
public OrdersRepository(AppDbContent appDbContent, ShopCart shopCart) { _appDbContent = appDbContent; this.shopCart = shopCart; }
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; }
public HouseRepository(AppDbContent appDbContent) { this.appDbContent = appDbContent; }
public ShopCartController(IAllMotors motorcycleRep, ShopCart shopCart, AppDbContent appDbContent) { _motorcycleRep = motorcycleRep; _shopCart = shopCart; _appDbContent = appDbContent; }
public PlantDetailRepository(AppDbContent appDbContent) { this.appDbContent = appDbContent; }
public Cart(AppDbContent appDbContent) { this.appDbContent = appDbContent; }
public ShopCart(AppDbContent appDbContent) { this._appDbContent = appDbContent; }
public ContentRepository(AppDbContent appDBContent) { this.appDBContent = appDBContent; }
public CategoryRepository(AppDbContent appDbContent) { this.appDbContent = appDbContent; }
public OrdersRepository(AppDbContent appDbContent, ShopCar shopCar) { this.appDbContent = appDbContent; this.shopCar = shopCar; }