I have db with this table (TableToDo):
I want display all records in TableToDo where login==Joe
.
All records I display so: Controller:
ASPNETDBEntities __db = new ASPNETDBEntities();
public ActionResult Index(TableToDo obj)
{
var th = (from TableToDo in __db.TableToDo select TableToDo).ToList();
return View(th);
}
and strongly-typed View(List):
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.text)
</td>
<td>
@Html.ActionLink("x", "Delete", new { id = item.id })
</td>
</tr>
}
Please tell me how display all records in TableToDo where login==Joe?
You have to do that when you get the data from the data source. So update your query to
var th = (from TableToDo in __db.TableToDo where TableToDo.Login="Joe" select TableToDo).ToList();