I have 3 tables in my database:
- Categories: ID(PK), CreationDate
- Languages: ID(PK), Title
- CategoryDetails: ID(PK), CategoryID(FK), LanguageID(FK), Title, Description
I've also created a ViewModel in MVC 4 with all the tables, but when I'm trying to list the Category Details in the view (.cshtml), the WHERE clause doesn't work as I was expected. I'm trying to list the Language not by key, but by Title.
@foreach (var item in Model.lstCategoryDetails)
{
<tr>
<td>@item.Title</td>
<td>@Model.lstLanguages.Title.Where(x => x.ID == @item.LanguageID)</td>
<td>@item.Description</td>
</tr>
}