public JsonResult InvalidCodes(string codeStr) { bool status = false; string message = string.Empty; List <int> codes = JsonConvert.DeserializeObject <List <int> >(codeStr); if (codes != null && codes.Any()) { var manager = new VipBaoYangPackageManager(); var checkResult = manager.IsAllUnUsed(codes); if (checkResult) { var invalidResult = manager.InvalidCodes(codes, User.Identity.Name); status = invalidResult.All(o => o.Value); message = $"{string.Join(",", invalidResult.Where(o => o.Value).Select(o => o.Key))}成功,{string.Join(",", invalidResult.Where(o => !o.Value).Select(o => o.Key))}失败"; } else { status = false; message = "选中的优惠券中包含已作废的券或者已使用的券,请刷新后重新操作"; } } return(Json(new { status = status, msg = message })); }