I am joining the two tables using LINQ to match model class like below
lstOptInInterest = new LinkedList<OptInInterestArea>
((from a in dbEntities.SUBCODE
from appCode in dbEntities.CODE.Where(
x => x.CODE == a.CODE && x.TYPE == a.TYPE)
select new OptInInterestArea()
{
Code = a.CODE,
SubCode = a.SUBCODE,
SubCodeDescription = a.DESCR,
CodeDescription = appCode.DESCR
}).ToList());
Model class
---
public class OptInInterestArea
{
[DisplayName("Code")]
public string Code { get; set; }
[DisplayName("Sub Code")]
public string SubCode { get; set; }
DisplayName("Sub Code Description")]
public string SubCodeDescription { get; set; }
[DisplayName("Code Description")]
public string CodeDescription { get; set; }
[DisplayName("Previous OptIn")]
public bool PrevOptIn { get; set; }
}
Table B
--
Now my question is I need to assign `
PrevOptIn` values of `
lstOptInInterest` from Table B (see above). Table B may or may not contains all of `
CODE` and `
SUBCODE` of `
lstOptInInterest`.
If `
CODE` and `
SUBCODE` of `
lstOptInInterest` exists on the table B assign to `
PrevOptIn` in else `
PrevOptIn = N`
How can I do LINQ to get this?
ItsMeSri MOSS SP2, 3 WEFs, Windows 2008 R2 x64.