hello,
this is not working giving error, i want fetch all data from table and bind to view page
i have this view model
indext method
view page
VEntities db = new VEntities();
public ActionResult Index()
{
var query = from all in db.asd select all;
return View(query);
}
public class ViewModel
{
public int id { get; set; }
public string heading { get; set; }
public string imagepath { get; set; }
}
@model IEnumerable<v2.viewmodels.viewmodel>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
</table>