public JsonResult Syn(string id) { try { if (id != "ALL") { IList <AccountType> list = NSession.CreateQuery("from AccountType where Platform='Ebay' and AccountName<>''").List <AccountType>(); foreach (var item in list) { if (item.AccountName == id) { if (!string.IsNullOrEmpty(item.ApiToken)) { EBayUtil.GetMyeBaySelling(item, NSession); } else { return(Json(new { ErrorMsg = "该账号无 ApiToke!", IsSuccess = false })); } } } } else { IList <AccountType> list = NSession.CreateQuery("from AccountType where Platform='Ebay' and AccountName<>'' and ApiToken<>''").List <AccountType>(); foreach (var item in list) { EBayUtil.GetMyeBaySelling(item, NSession); } } } catch (Exception ee) { return(Json(new { ErrorMsg = "出错了", IsSuccess = false })); } return(Json(new { IsSuccess = true, ErrorMsg = "同步成功!" }, JsonRequestBehavior.AllowGet)); }