// GET: app/DeleteCheck public ContentResult DeleteAjax(string cm, string del_prev_id, int objid) { string result = string.Empty; if (cm.ToUpper() == "DL" && del_prev_id.ToUpper() == "OBJ_DEL") { string urlrefer = Request.UrlReferrer.AbsolutePath; int count = 0; if (urlrefer.EndsWith("issuestatus", StringComparison.OrdinalIgnoreCase)) { // 问题状态,单独的表,单独处理 IIssueStatusService issueService = new IssueStatusService(); count = issueService.Delete(new IssueStatus { id = objid }); } else if (urlrefer.EndsWith("departmenttype", StringComparison.OrdinalIgnoreCase)) { // 组织类型,单独的表,单独处理 IDepartmentTypeService departmentTypeService = new DepartmentTypeService(); count = departmentTypeService.Delete(new DepartmentType { id = objid }); } else if (urlrefer.EndsWith("resourcelist", StringComparison.OrdinalIgnoreCase)) { // 组织类型,单独的表,单独处理 IResourceService resourceService = new ResourceService(); count = resourceService.Delete(new KTResource { id = objid.ToString() }); } else { count = service.Delete(0, objid); } if (count > 0) { result = "{\"ok\":true}"; } else { result = "{\"ok\":false,\"messagesFromController\":[{\"type\":\"ERROR\",\"title\":\"出了些问题\",\"message\":\"存在关联数据,无法删除\"}]}"; } } return(Content("{\"ok\":true}", "application/json", Encoding.UTF8)); }