Query by viewbag

in controller: ViewBag.db = <some_query>; in view: foreach (var item in ViewBag.db) { @Html.ActionLink((string)item.table.some, “Index”, “Edit”, new { id = item.someID }, null) }