I am trying to get only the headers that have a details using this Lambda statement
list = list.Where(c=> c.CustomerSalesPeople.Count>0);
but i am getting a null exception when I try to return the results
return list.OrderBy(c => c.CustomerName).ToList();
I have stepped through the code and see the null exception is generated right after I executed the first statement. Is there a better way to accomplish this.
EDIT
I tried the suggestions and i was still getting a null value. I figured I would try to explain better. I need a Lambda expression that matches this Query
SELECT *
FROM [customer]
where customer_record_id in (select distinct(customer_id)from customer_sales_person)