public JsonResult CheckLimitTimeBuy(string skuIds, string counts) { var skuIdsArr = skuIds.Split(','); var pCountsArr = counts.TrimEnd(',').Split(',').Select(t => int.Parse(t)); var productService = _iProductService; int index = 0; var products = skuIdsArr.Select(item => { var sku = productService.GetSku(item); var count = pCountsArr.ElementAt(index++); return(new CartItemModel() { id = sku.ProductId, count = count }); }).ToList().FirstOrDefault(); int exist = _iLimitTimeBuyService.GetMarketSaleCountForUserId(products.id, CurrentUser.Id); int MaxSaleCount = 0; var model = _iLimitTimeBuyService.GetLimitTimeMarketItemByProductId(products.id); if (model != null) { MaxSaleCount = model.LimitCountOfThePeople; } return(Json(new { success = MaxSaleCount >= exist + products.count, maxSaleCount = MaxSaleCount, remain = MaxSaleCount - exist })); }