public ActionResult Delete(int ID) { #region CWICCard cwiccd = new CWICCard(); Customer cust = cwiccd.FindCust(ID); if (cust != null) { ICCard iccd = cwiccd.Find(ic => ic.CustID == ID); if (iccd != null) { iccd.CustID = 0; Response _resp = cwiccd.Update(iccd); if (_resp.Code == 0) { //记录 } } Response resp = cwiccd.Delete(ID); if (resp.Code == 0) { var data = new { code = 1, message = "删除用户失败,请联系管理员!" }; return(Json(data, JsonRequestBehavior.AllowGet)); } #region 除相关指纹 CWFingerPrint fprint = new CWFingerPrint(); List <FingerPrint> fingerLst = fprint.FindList(p => p.CustID == ID); foreach (FingerPrint print in fingerLst) { fprint.Delete(print.ID); } #endregion } #endregion var nback = new { code = 2, message = "删除成功!" }; return(Json(nback, JsonRequestBehavior.AllowGet)); }