public bool DeleteBatch(int userId, int[] ids) { if (userId <= 0 || ids.Length == 0) { return(false); } using (var cxt = DbContext(DbOperation.Write)) { cxt.BeginTransaction(); var repo = new ShoppingCartRepo(cxt); var flag = repo.DeleteBatch(userId, ids); if (flag) { cxt.Commit(); } else { cxt.Rollback(); } return(flag); } }