// 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 <AppDbContext>(options => { options.UseSqlServer(_configuration.GetConnectionString("DefaultConnection")); }); services.AddTransient <IGetBooks, BookRepository>(); services.AddTransient <IBooksCategory, CategoryRepository>(); services.AddTransient <IAllOrders, OrdersRepository>(); services.AddTransient <IUser, UserRepository>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped(sp => PublicationCart.GetCart(sp)); services.AddMvc(options => options.EnableEndpointRouting = false); services.AddMemoryCache(); services.AddSession(); }
public OrdersRepository(AppDbContext appDbContent, PublicationCart publicationCart) { _appDbContent = appDbContent; _publicationCart = publicationCart; }
public PublicationCartController(IGetBooks bookRepository, PublicationCart publicationCart) { _bookRepository = bookRepository; _publicationCart = publicationCart; }
public OrderController(IAllOrders allOrders, PublicationCart publicationCart) { _allOrders = allOrders; _publicationCart = publicationCart; }