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 <AppDbContext>(options =>
                                                 options.UseSqlServer(_configurationRoot.GetConnectionString("DefaultConnection")));

            //Authentication, Identity config
            services.AddIdentity <IdentityUser, IdentityRole>()
            .AddEntityFrameworkStores <AppDbContext>();



            services.AddTransient <IDrinkRepository, DrinkRepository>();
            services.AddTransient <ICategoryRepository, CategoryRepository>();
            services.AddTransient <IOrderRepository, OrderRepository>();

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped(sp => ShopppingCart.GetCart(sp));
            services.AddControllersWithViews();
            services.AddMvc();
            services.AddMemoryCache();
            services.AddSession();
        }
Exemplo n.º 2
0
 public OrderRepository(AppDbContext appDbContext, ShopppingCart shoppingCart)
 {
     _appDbContext = appDbContext;
     _shoppingCart = shoppingCart;
 }
Exemplo n.º 3
0
 public ShoppingCartSummary(ShopppingCart shopppingCart)
 {
     _shoppingcart = shopppingCart;
 }
Exemplo n.º 4
0
 public OrderController(IOrderRepository orderRepository, ShopppingCart shoppingCart)
 {
     _orderRepository = orderRepository;
     _shoppingCart    = shoppingCart;
 }
Exemplo n.º 5
0
 public ShoppingCartController(IDrinkRepository drinkRepository, ShopppingCart shoppingCart)
 {
     _drinkRepository = drinkRepository;
     _shoppingCart    = shoppingCart;
 }