コード例 #1
0
 public List <ProductFilterValueResultSet> GetProductFilterValues(int productId)
 {
     using (ProductSpecificationDataContext dc = new ProductSpecificationDataContext())
     {
         ProductSpecificationRepository repo = new ProductSpecificationRepository(dc);
         return(repo.GetProductFilterValues(productId));
     }
     return(null);
 }
コード例 #2
0
 public bool UpdateFilterParameters(List <CategoryMasterFilterResultSet> categoryMasterFilter)
 {
     using (ProductSpecificationDataContext dc = new ProductSpecificationDataContext())
     {
         ProductSpecificationRepository repo = new ProductSpecificationRepository(dc);
         repo.AddCategoryMasterFilter(categoryMasterFilter);
     }
     return(true);
 }
コード例 #3
0
        public List <CategoryMasterFilter> GetCategoryFilters(int categoryId)
        {
            //var categoryfilterQuery = "Select Id, Category, FilterParameter from [CategoryMasterFilter] Where Category = {categoryId}".FormatWith(categoryId);
            //List<CategoryMasterFilter> categoryMasterFilterList = _unitOfWork.ExecuteQuery<CategoryMasterFilter>(categoryfilterQuery).ToList();
            //return categoryMasterFilterList;

            using (ProductSpecificationDataContext dc = new ProductSpecificationDataContext())
            {
                ProductSpecificationRepository repo = new ProductSpecificationRepository(dc);
                return(repo.GetCategoryMasterFilter(categoryId));
            }
        }
コード例 #4
0
        public bool UpdateProductSpecifications(ProductSpecificationsAllDTO productSpecifications)
        {
            var filter         = productSpecifications.productFilters;
            var keyFeatures    = productSpecifications.productKeyFeatures;
            var specifications = productSpecifications.productSpecifications;

            using (ProductSpecificationDataContext dc = new ProductSpecificationDataContext())
            {
                ProductSpecificationRepository repo = new ProductSpecificationRepository(dc);
                repo.AddFilter(filter);
                repo.AddKeyFeatures(keyFeatures);
                repo.AddSpecifications(specifications);
            }
            return(true);
        }
コード例 #5
0
        public async Task ProductSpecificationRepositoryCRUDTest()
        {
            var context = new NoodleDbContext("NoodleDb");

            context.Init();

            IProductSpecificationRepository repository = new ProductSpecificationRepository(context);

            var id = Guid.NewGuid();

            var record = new ProductSpecification
            {
                Id      = id,
                BaseQty = 10,
                Child   = new Product
                {
                    Id = Guid.Empty
                },
                ChildUom = new Data.Business.Uom
                {
                    Id = Guid.Empty
                },
                Parent = new Product
                {
                    Id = Guid.Empty
                }
            };

            await repository.CreateAsync(record);

            record.BaseQty = 15;

            await repository.UpdateAsync(record);

            var record2 = await repository.GetByIdAsync(id);

            Assert.AreEqual(record.Id, record2.Id);
            Assert.AreEqual(record.BaseQty, record2.BaseQty);

            await repository.DeleteAsync(record.Id);

            var record3 = await repository.GetByIdAsync(id);

            Assert.IsNull(record3);
        }
コード例 #6
0
 public UnitOfWork(ApplicationDbContext context)
 {
     this._context         = context;
     Categories            = new CategoryRepository(_context);
     Producers             = new ProducerRepository(_context);
     Roles                 = new RoleRepository(_context);
     Accounts              = new AccountRepository(_context);
     AvatarOfProducts      = new AvatarOfProductRepository(_context);
     Carts                 = new CartRepository(_context);
     Comments              = new CommentRepository(_context);
     Customers             = new CustomerRepository(_context);
     Invoices              = new InvoiceRepository(_context);
     Orders                = new OrderRepository(_context);
     Products              = new ProductRepository(_context);
     ProductsOfOrders      = new ProductsOfOrderRepository(_context);
     ProductSpecifications = new ProductSpecificationRepository(_context);
     SpecificationValues   = new SpecificationValueRepository(_context);
     StarRatings           = new StarRatingRepository(_context);
     Sellers               = new SellerRepository(_context);
 }