public void DelUserByIds(string ids) { if (!string.IsNullOrEmpty(ids)) { var idsArray = ids.Split(','); _demoRepository.DeleteById(idsArray); } }
/// <summary> /// 删除Demo /// </summary> /// <param name="Id"></param> /// <returns></returns> public bool DeleteDemoById(long Id) { try { _demoRepository.BeginTran();//开始事务 bool result = _demoRepository.DeleteById(Id); _demoRepository.CommitTran(); return(result); } catch (Exception ex) { _demoRepository.RollbackTran();//回滚事务 throw ex; } }
/// <summary> /// 删除Demo /// </summary> /// <param name="Id"></param> /// <returns></returns> public ResultModel <bool> DeleteDemo(long Id) { var result = new ResultModel <bool>(); try { _demoRepository.BeginTran(); //开始事务 result.Data = _demoRepository.DeleteById(Id); _demoRepository.CommitTran(); //提交事务 return(result); } catch (Exception ex) { _demoRepository.RollbackTran();//回滚事务 throw ex; } }