I try to create a linq join query in the nopCommerce 3.0. i join two table in linq and write
the code successfully. but the visual studio intellicence shows the error like
A lambda expression with a statement body cannot be converted to an expression tree
please see my code below
var roles = _customerEventRoleRepository.Table.Where(c => c.EventId == selevent)
.Join
(
_customerRepository.Table,
cev => cev.CustomerId, c => c.Id,
(cev, c) =>
{
var cust = new CustomerEventRolesModel();
cust.Id = cev.Id;
cust.CustomerId = c.Id;
cust.Customer = c.Email;
cust.ContactName = c.GetAttribute<string>(SystemCustomerAttributeNames.FirstName);
cust.CompanyName = c.GetAttribute<string>(SystemCustomerAttributeNames.Company);
cust.Speaker = cev.IsSpeaker;
cust.Sponsor = cev.IsSponser;
return cust;
}
).OrderBy(cev => cev.Customer).ToList();
but the error shows
please help