public ActionResult FetchProductByPID(string pid) { var activityid = TempData["aid"]?.ToString(); 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; } } TempData["aid"] = activityid; return(Json(product)); }
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)); }