I have two collections that I am comparing data against. I can join the two collections by ids. I need to have a where clause that returns a list of data where certain items in collection B were not found in collection A
public class Contract
{
public string ContractId { get; set; }
public IList InvoiceList { get; set; }
public class Invoice
{
public int InvoiceNumber { get; set; }
}
}
public class PaymentRequest
{
public IList Contracts { get; set; }
public class ContractList
{
public string ContractId { get; set; }
public IList Invoices { get; set; }
}
public class InvoiceList
{
public int InvoiceNumber { get; set; }
}
}
I have the following so far but can't quite get the where clause down.
var query = (
from request in (
from contract in paymentRequest.Contracts
from invoice in contract.Invoices
select new { contract, invoice })
join valid in (
from contract in validContracts
select new { contract })
on new { request.contract.ContractId } equals new { valid.contract.ContractId }
where !(
// get a list of invoice numbers in the request data set that are not in the valid data set
)
select "Contract Id: " + request.contract.ContractId +
", Invoice Number: " + request.invoice.InvoiceNumber
).ToList();
Any help is appreciated.