public Task <int> Delete(string keyValue) { if (service.IQueryable().Count(t => t.ParentId.Equals(keyValue)) > 0) { throw new Exception("删除失败!操作的对象包含了下级数据。"); } else { return(service.DeleteAsync(t => t.Id == keyValue)); } }
public Task <int> Delete(string keyValue, string tenantId) { if (repo.IQueryable().Count(t => t.ParentId.Equals(keyValue)) > 0) { throw new Exception("删除失败!操作的对象包含了下级数据。"); } else { return(repo.DeleteAsync(t => t.Id == keyValue && t.TenantId == tenantId)); } }