예제 #1
0
        public IActionResult Put(int spuId, [FromBody] SpuInfo spuInfo)
        {
            var spu = new ProductSpu();

            spu.Id         = spuInfo.Id;
            spu.BrandId    = spuInfo.BrandId;
            spu.CategoryId = spuInfo.CategoryId;
            spu.Name       = spuInfo.Name;
            spu.ShopId     = spuInfo.ShopId;

            var saleSpecValues  = new List <SpuSaleSpecValue>();
            var spuSaleSpecList = spuInfo.SpuSaleSpecValues;

            foreach (var item in spuSaleSpecList)
            {
                var spuSaleSpec = new SpuSaleSpecValue();
                spuSaleSpec.SaleSpecId      = item.SaleSpecId;
                spuSaleSpec.SaleSpecValueId = item.SaleSpecValueId;
                spuSaleSpec.SpuId           = item.SpuId;
                saleSpecValues.Add(spuSaleSpec);
            }
            spu.SpuSaleSpecValues = saleSpecValues;
            _productService.UpdateSpu(spu);
            return(Ok());
        }
예제 #2
0
        public void CreateSpu(ProductSpu productSpu)
        {
            //插入spu信息 并返回spu id
            var id = _spuRepository.CreateSpu(productSpu);

            //插入销售属性及销售属性值
            foreach (var saleSpecValue  in productSpu.SpuSaleSpecValues)
            {
            }
        }
예제 #3
0
        public IActionResult Post([FromBody] SpuInfo spuInfo)
        {
            var spu = new ProductSpu();

            spu.BrandId    = spuInfo.BrandId;
            spu.CategoryId = spuInfo.CategoryId;
            spu.Name       = spuInfo.Name;
            spu.ShopId     = spuInfo.ShopId;

            var spuSaleSpecInfo = spuInfo.SpuSaleSpecValues;

            foreach (var item in spuSaleSpecInfo)
            {
                var spuSaleSpecValue = new SpuSaleSpecValue();
                spuSaleSpecValue.SaleSpecId      = item.SaleSpecId;
                spuSaleSpecValue.SaleSpecValueId = item.SaleSpecValueId;
                spuSaleSpecValue.SpuId           = item.SpuId;
                _productService.CreateSpu(spu);
            }

            _productService.CreateSpu(spu);
            //插入
            return(Ok());
        }
예제 #4
0
 public void UpdateSpu(ProductSpu productSpu)
 {
     _spuRepository.UpdateSpu(productSpu);
 }