Exemplo n.º 1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddDbContext <AppDBContent>(options => options.UseSqlServer(_confString.GetConnectionString("DefaultConnection")));
     //  services.AddDbContext<AppDBContext>(options => options.UseSqlServer("Server=DESKTOP-0KVSS8M\\SQLEXPRESS; Database=Shop; Trusted_Connection=true"));
     services.AddControllersWithViews();
     services.AddScoped <IAllSites, SiteRepository>();
     services.AddScoped <ISiteCategory, CategoryRepository>();
     services.AddScoped <IAllOrders, OrdersRepository>();
     //services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
     services.AddHttpContextAccessor();
     services.AddSession();
     services.AddScoped(sp => ShopSite.GetSite(sp));
     services.AddMemoryCache();
 }
Exemplo n.º 2
0
 public OrderController(IAllOrders allOrders, ShopSite shopSite)
 {
     this.allOrders = allOrders;
     this.shopSite  = shopSite;
 }
Exemplo n.º 3
0
 public OrdersRepository(AppDBContent appDBContent, ShopSite shopSite)
 {
     this.appDBContent = appDBContent;
     this.shopSite     = shopSite;
 }
Exemplo n.º 4
0
 public ShopSiteController(IAllSites sitRep, ShopSite shopSite)
 {
     _sitRep   = sitRep;
     _shopSite = shopSite;
 }