public ActionResult Delete(int id) { try { SysDictTypeService.DeleteBy(x => x.Id == id); return(WriteSuccess("数据删除成功")); } catch (Exception ex) { return(WriteError(ex)); } }
public ActionResult BatchDel(string idsStr) { try { var idsArray = idsStr.Substring(0, idsStr.Length).Split(','); int[] ids = Array.ConvertAll <string, int>(idsArray, int.Parse); var result = SysDictTypeService.DeleteBy(x => ids.Contains(x.Id)) > 0 ? WriteSuccess("数据删除成功") : WriteError("数据删除失败"); return(result); } catch (Exception ex) { return(WriteError(ex)); } }