public productsController(IProductRepo productRepo, IReviewRepo reviewRepo, IMapper mapper, IClientService clientService)
 {
     _ProductRepo   = productRepo;
     _ReviewRepo    = reviewRepo;
     _mapper        = mapper;
     _clientService = clientService;
 }
Пример #2
0
 public ProductController(IGenericsRepo <ProductType> productTypes, IGenericsRepo <ProductBrand> productBrand, IProductRepo productRepo, IMapper mapper)
 {
     _mapper       = mapper;
     _productBrand = productBrand;
     _productRepo  = productRepo;
     _productTypes = productTypes;
 }
Пример #3
0
 public ShoppingCartRepo(StoreContext context,
                         IProductRepo productRepo,
                         ICustomerRepo customerRepo) : base(context)
 {
     _productRepo  = productRepo;
     _customerRepo = customerRepo;
 }
Пример #4
0
 public ProductsController(IProductRepo productRepo, ICategoryRepo categoryRepo,
                           IOptionsSnapshot <CustomSettings> settings, ILogger <ProductsController> logger)
 {
     _productRepo  = productRepo;
     _categoryRepo = categoryRepo;
     Logger        = logger;
 }
Пример #5
0
        public ActionResult Detail(int id)
        {
            IProductRepo repo    = UnitOfWork.ProductRepo;
            Product      product = repo.FindById(id);

            return(View(product));
        }
Пример #6
0
 public OrderBLL(IOrderRepo stub)
 {
     _repo = stub;
     _productrepo = new ProductRepoStub();
     _customerrepo = new CustomerRepoStub();
     _accountrepo = new AccountRepoStub();
 }
Пример #7
0
 public GetProductsAndFiltr(
     IProductRepo productRepo,
     List <IFilter <Product> > filters)
 {
     _productRepo = productRepo;
     _filters     = filters;
 }
Пример #8
0
        public ActionResult List(int id = 1, string product = null, int?category = null)
        {
            IProductRepo   repo     = UnitOfWork.ProductRepo;
            List <Product> products = null;

            if (product != null && category != null)
            {
                products = repo.Get(p => p.CategoryId == category.Value && p.Name.Contains(product)).ToList();
            }
            else
            if (product != null)
            {
                products = repo.Get(p => p.Name.Contains(product)).ToList();
            }
            else
            if (category != null)
            {
                products = repo.Get(p => p.CategoryId == category.Value).ToList();
            }
            else
            {
                products = repo.Get().ToList();
            }
            IEnumerable <GetProductListViewModel> result = products.Select(p => new GetProductListViewModel
            {
                Id       = p.Id,
                Name     = p.Name,
                Category = p.Category.Name,
                Price    = p.Price,
            });

            ViewData["categories"] = UnitOfWork.CategoryRepo.Get().ToList();
            return(View(result.ToPagedList(id, 10)));
        }
 public OrderController(ILoginRepo loginRepo, IOrderRepo orderRepo, ICartRepo cartRepo, IProductRepo productRepo)
 {
     _orderRepo   = orderRepo;
     _loginRepo   = loginRepo;
     _cartRepo    = cartRepo;
     _productRepo = productRepo;
 }
Пример #10
0
        public IHttpActionResult AddProductToBasket([FromBody] AddProductToBasketRequest request)
        {
            User user = GetCurrentUser();

            if (user == null)
            {
                return(Unauthorized());
            }
            IProductRepo repo    = UnitOfWork.ProductRepo;
            Product      product = repo.FindById(request.Id);

            try
            {
                UnitOfWork.Context.Database.ExecuteSqlCommand($"do $$ begin perform \"dbo\".add_product_to_basket({user.Id}, {product.Id}); end $$");
                return(Ok(
                           UnitOfWork
                           .Context.Database
                           .SqlQuery <int>($"select \"dbo\".get_product_count_from_basket({user.Id}, {product.Id});")
                           .FirstOrDefault()));
            }
            catch
            {
                return(BadRequest());
            }
        }
        public OrderManager(IRepo repo, ITaxRepo taxRepo, IProductRepo prodRepo)
        {
            _orderRepo = repo;

            taxes    = taxRepo.Load();
            products = prodRepo.Load();
        }
Пример #12
0
 public ProductController(IUserRepo _iUserRepo, IAddressRepo _iAddressRepo, IProductRepo _iProductRepo, IProductOfferRepo _iProductOfferRepo)
 {
     iUserRepo         = _iUserRepo;
     iAddressRepo      = _iAddressRepo;
     iProductRepo      = _iProductRepo;
     iProductOfferRepo = _iProductOfferRepo;
 }
Пример #13
0
 public OrderBLL()
 {
     _repo = new OrderRepo();
     _productrepo = new ProductRepo();
     _customerrepo = new CustomerRepo();
     _accountrepo = new AccountRepo();
 }
Пример #14
0
 public ProductOfUserController(IProductOfUserRepo repository, IMapper mapper, IUserRepo userRepo, IProductRepo productRepo)
 {
     _productRepo = productRepo;
     _userRepo    = userRepo;
     _repository  = repository;
     _mapper      = mapper;
 }
Пример #15
0
 internal ShoppingCartRepo(DbContextOptions <StoreContext> options)
     : base(options)
 {
     _productRepo  = new ProductRepo(Context);
     _customerRepo = new CustomerRepo(Context);
     base.Dispose();
 }
 public ProductsController(
     IProductRepo productRepo,
     IOptionsSnapshot <CustomSettings> settings)
 {
     _settings    = settings.Value;
     _productRepo = productRepo;
 }
 public SavedItemsController(IClientService ClientService, IMapper mapper, UserManager <CustomIdentityUser> userManager, IProductRepo productRepo)
 {
     _ClientService = ClientService;
     _mapper        = mapper;
     _UserManager   = userManager;
     _productRepo   = productRepo;
 }
 public HistoryController(UserManager <CustomIdentityUser> userManager, IProductRepo productRepo, IMapper mapper, IClientService clientService)
 {
     _UserManager   = userManager;
     _productRepo   = productRepo;
     _mapper        = mapper;
     _clientService = clientService;
 }
Пример #19
0
 public UnitOfWork(DbContext context)
 {
     this.Context = context;
     consumer     = new ConsumerRepo(context);
     product      = new ProductRepo(context);
     //add attrs
 }
Пример #20
0
 public ProductsController(IWebHostEnvironment webHost, IMapper mapper,
                           IProductRepo productRepo, ICategoryRepo categoryRepo)
 {
     this.webHost      = webHost;
     this.mapper       = mapper;
     this.productRepo  = productRepo;
     this.categoryRepo = categoryRepo;
 }
Пример #21
0
 public ProductController(IProductRepo repo, AppDBContext db,
                          IHostingEnvironment hostingEnvironment, ILogger <ProductController> logger)
 {
     this.repo = repo;
     this.db   = db;
     this.hostingEnvironment = hostingEnvironment;
     _logger = logger;
 }
Пример #22
0
 public FactorsController(IFactorRepo repository, IProductRepo productRepo, ICustomerRepo customerRepo, IOrderItemRepo orderItemRepo, IMapper mapper)
 {
     _repository    = repository;
     _productRepo   = productRepo;
     _customerRepo  = customerRepo;
     _orderItemRepo = orderItemRepo;
     _mapper        = mapper;
 }
Пример #23
0
 public OrderService(IOrderRepo orderRepo, IProductRepo productRepo, ICustomerRepo customerRepo, IPaymentService paymentService, IShipStuff shippingService)
 {
     _orderRepo       = orderRepo;
     _productRepo     = productRepo;
     _customerRepo    = customerRepo;
     _paymentService  = paymentService;
     _shippingService = shippingService;
 }
Пример #24
0
        public AnalyticsViewModel(IProductRepo productRepo, IOccupanciesRepo occupancieRepo)
        {
            _productRepo            = productRepo;
            _occupancieRepo         = occupancieRepo;
            ToProductAddViewCommand = new RelayCommand(ToReservationAddView);

            UpdateDataCommand = new RelayCommand(UpdateData);
        }
Пример #25
0
 public BasketController(UserManager <User> userManager, IMapper mapper, IGenericsRepo <BasketItem> basketGenericRepo, IBasketRepo basketRepo, IProductRepo productRepo)
 {
     _mapper            = mapper;
     _userManager       = userManager;
     _basketRepo        = basketRepo;
     _productRepo       = productRepo;
     _basketGenericRepo = basketGenericRepo;
 }
Пример #26
0
 public OrderService(IOrderRepo orderRepo, IProductRepo productRepo, ICustomerRepo customerRepo, IPaymentService paymentService, IBuildShips shipBuilder)
 {
     _orderRepo      = orderRepo;
     _productRepo    = productRepo;
     _customerRepo   = customerRepo;
     _paymentService = paymentService;
     _shipBuilder    = shipBuilder;
 }
Пример #27
0
 public HomeController(ILogger <HomeController> logger, IStoreRepo StoreRepo, ICustomerRepo CustomerRepo, IOrderRepo OrderRepo, IProductRepo ProductRepo)
 {
     _logger       = logger;
     _storeRepo    = StoreRepo;
     _customerRepo = CustomerRepo;
     _orderRepo    = OrderRepo;
     _productRepo  = ProductRepo;
 }
Пример #28
0
 public ProductService(
     ILoggerAdapter <ProductService> logger,
     IMetricService metrics,
     IProductRepo productRepo)
 {
     _productRepo = productRepo;
     _logger      = logger;
     _metrics     = metrics;
 }
Пример #29
0
 public ProductsController(
     IProductRepo productRepo,
     IOptionsSnapshot <CustomSettings> settings,
     ILogger <ProductsController> logger)
 {
     _settings    = settings.Value;
     _productRepo = productRepo;
     Logger       = logger;
 }
 public ShoppingCartController(ILogger <ShoppingCartController> logger, IStoreRepo StoreRepo, ICustomerRepo CustomerRepo, IOrderRepo OrderRepo, IProductRepo ProductRepo, IShoppingCart ShoppingCart)
 {
     _logger       = logger;
     _storeRepo    = StoreRepo;
     _customerRepo = CustomerRepo;
     _orderRepo    = OrderRepo;
     _productRepo  = ProductRepo;
     _shoppingCart = ShoppingCart;
 }
Пример #31
0
 public ProductsController(IProductRepo productRepo)
 {
     _productRepo = productRepo;
     _config      = new MapperConfiguration(
         cfg =>
     {
         cfg.CreateMap <ProductAndCategoryBase, AddToCartViewModel>();
     });
 }
Пример #32
0
 public ProductsController(
     ILogger <ProductsController> logger,
     IProductRepo productRepo,
     IOptionsMonitor <CustomSettings> settings)
 {
     _settings    = settings.CurrentValue;
     _logger      = logger;
     _productRepo = productRepo;
 }
Пример #33
0
 public ProductUnitTest()
 {
     var factoryMock = new Mock<IDBContextFactory>();
     fakeProductDbContext = new FakeProductDbContext();
     productRepo = new ProductRepo(factoryMock.Object);
     factoryMock.Setup(o => o.createDbContext<IProductDbContext>(It.IsAny<String>()))
         .Returns(fakeProductDbContext);
     initData();
 }
Пример #34
0
 public ProductUnitTestDb()
 {
     scope = new TransactionScope(TransactionScopeOption.Required,
       new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
       TransactionScopeAsyncFlowOption.Enabled);
   
     productDbContext = new ProductDbContext(ConnectionString); 
     factoryMock = new Mock<IDBContextFactory>();
     productRepo = new ProductRepo(factoryMock.Object);
     factoryMock.Setup(o => o.createDbContext<IProductDbContext>(It.IsAny<String>()))
         .Returns(productDbContext);
 }
Пример #35
0
 public OrderManager()
 {
     string mode = ConfigurationManager.AppSettings["appName"];
     if (mode == "Test")
     {
         var repo = new TestOrderRepo();
         _repo = repo;
     }
     else
     {
         var repo = new ProdOrderRepo();
         _repo = repo;
         _taxrepo = new TaxRepo();
         _productrepo = new ProductRepo();
     }
 }
Пример #36
0
 public ProductController(IProductRepo repo)
 {
     _repository = repo;
 }
 public ProductBLL()
 {
     _repo = new ProductRepo();
 }
Пример #38
0
 public CartRepo(IProductRepo productRepo, IDBContextFactory factory)
 {
     this.productRepo = productRepo;
     this.factory = factory;
 }
 public ProductBLL(IProductRepo stub)
 {
     _repo = stub;
 }
Пример #40
0
 public ProductBLL()
 {
     _productRepo = new ProductRepo();
     _categoryRepo = new CategoryRepo();
 }
Пример #41
0
 public ProductBLL(IProductRepo stub)
 {
     _productRepo = stub;
     _categoryRepo = new CategoryRepoStub();
 }