Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <AppDBContent>(options => options.UseSqlServer(_confString.GetConnectionString("DefaultConnection")));
            services.AddTransient <IAllToys, ToyRepository>();
            services.AddTransient <IToysCategory, CategoryRepository>();
            services.AddTransient <IAllOrders, OrdersRepository>();


            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped(sp => ToyShopCart.GetCart(sp));
            // services.AddMvc();
            services.AddMvc(options => options.EnableEndpointRouting = false);
            services.AddMemoryCache();
            services.AddSession();
        }
 public ToyShopCartController(IAllToys toyRep, ToyShopCart toyShopCart)
 {
     _toyRep      = toyRep;
     _toyShopCart = toyShopCart;
 }
Exemplo n.º 3
0
 public OrderController(IAllOrders allOrders, ToyShopCart toyShopCart)
 {
     this.AllOrders   = allOrders;
     this.ToyShopCart = toyShopCart;
 }