i have this query which returns list works fine
var q = (from p in db.Profiles
join ce in db.CoachExpertises on p.UserName equals ce.UserName
select new {
username=p.UserName,
FirstName=p.FirstName,
LastName=p.LastName,
Avatar=p.Avatar,
Summary=ce.Summary,
Introduction=ce.Introduction,
Country=p.Country,
Degrees=ce.Degrees.Replace(","," | "),
videolink =ce.PresentationLink,
Languages=p.Language.Replace(",", " | ")
});
then here if query string value is not null so am running query which returns only user name
string expertise = "";
if (this.RouteData.Values["Expertise"] != null)
{
expertise = this.RouteData.Values["Expertise"].ToString();
var e = (from ue in db.UserExpertises
join ex in db.Expertises on ue.ExpertiseId equals ex.ExpertiseId
where ex.Urlpath == expertise.ToString()
select new
{
Fusername = ue.UserName
});
then i want to loop second query e and pass the username to first query q so its filter the data based on user name
//here i want to filter data based on above query
foreach (var item in e)
{
//pass filter data to q as list
q = q.Where(u => u.username == item.Fusername);
}
for e.g
firs query retursn following value
A
B
C
second quer e runs returns only
A
B
so e values A and B should passs to first query make it inner join and first query now should onlyu return A and B