model.ListManagerReviewerMapping = (from a in wallet.OM_Employee
join m in wallet.APPR_ManagerMapping
on a.AssociateId equals m.AssociateId
where m.ManagerId==Context.UserId.Value **into** MM
from leftjoinresult in M.DefaultIfEmpty()
where a.CompanyId == Context.CompanyId && (a.TermStatus == "L" || a.SeparationDate > DateTime.Today)
select new ManagerAndReviewerMappingModel.ManagerAndReviewerMapping()
{
Photo = (photoUrl + "?AssociateCode=" + a.AssociateCode),
AssociateId = a.AssociateId,
AssociateCode = a.AssociateCode,
AssociateName = a.AssociateName
}).ToList();
Asked
Active
Viewed 572 times
0

Tetsuya Yamamoto
- 24,297
- 8
- 39
- 61

ramesh kumar
- 11
- 5
-
Please format your code in a readable manner. Hint: Indent by 4 spaces. And what is actually the problem or question? – Bjarke M Sep 14 '17 at 06:41
-
What is the Question or problem? – Feras Al Sous Sep 14 '17 at 06:43
-
**into** get error from A query body must end with a select clause or a group clause in LINQ Query – ramesh kumar Sep 14 '17 at 06:44
-
What do you mean by `**into** MM` in your code? – shA.t Sep 14 '17 at 06:57
2 Answers
1
//Remove brackets and .ToList();
model.ListManagerReviewerMapping = from a in wallet.OM_Employee
join m in wallet.APPR_ManagerMapping
on a.AssociateId equals m.AssociateId
where m.ManagerId==Context.UserId.Value **into** MM
from leftjoinresult in M.DefaultIfEmpty()
where a.CompanyId == Context.CompanyId && (a.TermStatus == "L" || a.SeparationDate > DateTime.Today)
select new ManagerAndReviewerMappingModel.ManagerAndReviewerMapping()
{
Photo = (photoUrl + "?AssociateCode=" + a.AssociateCode),
AssociateId = a.AssociateId,
AssociateCode = a.AssociateCode,
AssociateName = a.AssociateName
};

Manfice
- 149
- 7
1
You need to use Where
extension method for first query, as the query uses left join with DefaultIfEmpty
(note that you can't use into
after where
clause since where
must be followed with select
to finish the query):
model.ListManagerReviewerMapping = (from a in wallet.OM_Employee
join m in wallet.APPR_ManagerMapping.Where(x => x.ManagerId == Context.UserId.Value)
on a.AssociateId equals m.AssociateId into MM
from leftjoinresult in MM.DefaultIfEmpty()
where a.CompanyId == Context.CompanyId && (a.TermStatus == "L" || a.SeparationDate > DateTime.Today)
select new ManagerAndReviewerMappingModel.ManagerAndReviewerMapping()
{
Photo = (photoUrl + "?AssociateCode=" + a.AssociateCode),
AssociateId = a.AssociateId,
AssociateCode = a.AssociateCode,
AssociateName = a.AssociateName
}).ToList();
Similar issues:

Tetsuya Yamamoto
- 24,297
- 8
- 39
- 61