示例#1
0
        /// <summary>
        /// 设置商品分类。
        /// </summary>
        /// <param name="productID">需要进行分类的商品ID值。</param>
        /// <param name="categoryID">商品分类ID值。</param>
        /// <returns>带有商品分类信息的对象。</returns>
        public CategorizationDataObject CategorizeProduct(Guid productID, Guid categoryID)
        {
            if (productID == Guid.Empty)
            {
                throw new ArgumentNullException("productID");
            }
            if (categoryID == Guid.Empty)
            {
                throw new ArgumentNullException("categoryID");
            }
            var product  = productRepository.GetByKey(productID);
            var category = categoryRepository.GetByKey(categoryID);

            return(Mapper.Map <Categorization, CategorizationDataObject>(domainService.Categorize(product, category)));
        }
示例#2
0
        public ProductCategorizationDto CategorizeProduct(Guid productId, Guid categoryId)
        {
            if (productId == Guid.Empty)
            {
                throw new ArgumentNullException("productId");
            }
            if (categoryId == Guid.Empty)
            {
                throw new ArgumentNullException("categoryId");
            }
            var product  = _productRepository.GetByKey(productId);
            var category = _categoryRepository.GetByKey(categoryId);

            return(Mapper.Map <ProductCategorization, ProductCategorizationDto>(_domainService.Categorize(product, category)));
        }