public ActionResult FetchProductWithCostPriceByPid(string pid, string activityId) { var product = new ProductModel(); using (var client = new ProductClient()) { var sku = client.FetchProduct(pid); sku.ThrowIfException(true); if (sku.Success && sku.Result != null) { product.PID = pid; product.OnSale = sku.Result.Onsale; product.Stockout = sku.Result.Stockout; product.DisplayName = sku.Result.DisplayName; product.Image = sku.Result.Image; product.cy_list_price = sku.Result.Price; } }; //var product = QiangGouManager.FetchProductByPID(pid); if (!string.IsNullOrEmpty(product.PID) && product.PID != pid) { product.CaseSensitive = true; } if (!string.IsNullOrEmpty(activityId)) { var saleoutqty = QiangGouManager.SelectFlashSaleSaleOutQuantity(activityId, pid); product.TotalQuantity = saleoutqty; product.SaleOutQuantity = saleoutqty ?? 0; } var costPriceModel = QiangGouManager.SelectcostPriceSql(pid).FirstOrDefault(); if (costPriceModel != null) { product.CostPrice = costPriceModel.CostPrice; } product = QiangGouManager.AssemblyProductInstalService(product); return(Json(product, JsonRequestBehavior.AllowGet)); }
public ActionResult FetchProductWithCostPriceByPid(string pid, string activityId) { var product = QiangGouManager.FetchProductByPID(pid); if (product != null) { if (!string.IsNullOrEmpty(product.PID) && product.PID != pid) { product.CaseSensitive = true; } if (!string.IsNullOrEmpty(activityId)) { var saleoutqty = QiangGouManager.SelectFlashSaleSaleOutQuantity(activityId, pid); product.TotalQuantity = saleoutqty; product.SaleOutQuantity = saleoutqty ?? 0; } var costPriceModel = QiangGouManager.SelectcostPriceSql(pid).FirstOrDefault(); if (costPriceModel != null) { product.CostPrice = costPriceModel.CostPrice; } } return(Json(product, JsonRequestBehavior.AllowGet)); }