I have one LINQ Query. I dont know much about LINQ. I was working on Entity Framework. I have to get the records based on the Input Date (CDate). Assume the structure is something like this.
Table A Table B
Id CDate Id No A_Id
1 11-11-2012 1 1001 1
2 11-11-2012 2 1002 1
3 12-12-2012 3 1003 2
Based on this table definition if the input date is some like 11-11-2012, the output should be like,
Table B
Id No
1 1001
2 1002
3 1003
something like the above. I have tried this one but its not working. Pls have a look at this code.
Code
var model = (from x in Db.TableB
where x.TableA.CDate == 'Input Value' // 11-11-2012
select new ViewModel
{
}).Tolist();
Please tell me the possibilities that i can write code to get the Distinct value for the appropriate input date.
Thanks,
Do you want some thing like this?
Output:
UPDATE
Sorry, first, I thought there is one-to-one relationship. But your entity has one-to-many relationships. Your codes are correct, only add