예제 #1
0
        public async Task <IActionResult> UpdateShopSku(ShopSkuEntity entity)
        {
            if (ModelState.IsValid)
            {
                var data = await shopService.UpdateShopSku(entity);

                return(Json(data));
            }
            return(Json(ParrNoPass()));
        }
예제 #2
0
        public async Task <BaseResult <bool> > UpdateShopSku(ShopSkuEntity entity)
        {
            //判断必须传递参数
            if (string.IsNullOrEmpty(entity.shopsku_id))
            {
                return(new BaseResult <bool>(808, false));
            }
            if (Convert.ToDouble(entity.shopsku_currentprice) > Convert.ToDouble(entity.shopsku_originalprice))
            {
                return(new BaseResult <bool>(3005, false));
            }

            var isTrue = await shopSkuRepository.UpdateAsync(entity, true, true, c => c.shop_code, c => c.shopsku_originalprice, c => c.shopsku_currentprice, c => c.shopsku_url, c => c.shopsku_code);

            if (!isTrue)
            {
                return(new BaseResult <bool>(201, false));
            }
            return(new BaseResult <bool>(200, true));
        }
예제 #3
0
        public async Task <BaseResult <string> > AddShopSku(ShopSkuEntity entity)
        {
            //商品添加,名称可重复,含有商品编号区分
            if (string.IsNullOrEmpty(entity.shop_id) || string.IsNullOrEmpty(entity.shopsku_code))
            {
                return(new BaseResult <string>(808, ""));
            }
            if (Convert.ToDouble(entity.shopsku_currentprice) > Convert.ToDouble(entity.shopsku_originalprice))
            {
                return(new BaseResult <string>(3005, ""));
            }

            var isTrue = await shopSkuRepository.AddAsync(entity);

            if (!isTrue)
            {
                return(new BaseResult <string>(201, ""));
            }
            return(new BaseResult <string>(200, entity.shopsku_id));
        }