when i try to run the code
public static DalUser ToDalUser(this User ormUser)
{
return new DalUser()
{
Id = ormUser.Id,
FirstName = ormUser.FirstName,
LastName = ormUser.LastName,
About = ormUser.About,
Email = ormUser.Email,
Password = ormUser.Password,
Roles = ormUser.Roles.Select(role => role.ToDalRole())
};
}
error occurs
Additional information: LINQ to Entities does not recognize the method 'DAL.Interface.DTO.DalUser ToDalUser(ORM.User)' method, and this method cannot be translated into a store expression.
in View
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.FirstName)
</td>
<td>
@Html.DisplayFor(modelItem => item.LastName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
@Html.DisplayFor(modelItem => item.About)
</td>
<td>
@Html.DisplayTextFor(modelItem => item.Role)
</td>
</tr>
}
what's the problem? please, help!