// 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(); }
public OrderController(IAllOrders allOrders, ShopSite shopSite) { this.allOrders = allOrders; this.shopSite = shopSite; }
public OrdersRepository(AppDBContent appDBContent, ShopSite shopSite) { this.appDBContent = appDBContent; this.shopSite = shopSite; }
public ShopSiteController(IAllSites sitRep, ShopSite shopSite) { _sitRep = sitRep; _shopSite = shopSite; }