.NetCoreMVC Simple Table

Musa BAL
Oct 16, 2024

--

@model IEnumerable<Product>

@{

ViewData[“Title”] = “Home Page”;

}

<table class=”table table-bordered table-striped”>

<thead>

<tr>

<th>@Html.DisplayNameFor(m => m.ProductId)</th>

<th>@Html.DisplayNameFor(m => m.Image)</th>

<th>@Html.DisplayNameFor(m => m.Name)</th>

<th>@Html.DisplayNameFor(m => m.Price)</th>

</tr>

</thead>

<tbody>

@foreach (var prd in @Model)

{

<tr>

<td>@prd.ProductId</td>

<td><img src=”~/img/@prd.Image” width=”100" height=”100"></td>

<td>@prd.Name</td>

<td>@prd.Price</td>

<td> <a href=”” class=”btn btn-sm btn-primary”>Edit</a></td>

<td> <a href=”” class=”btn btn-sm btn-danger”>Delete</a></td>

</tr>

}

</tbody>

</table>

--

--

Musa BAL
Musa BAL

No responses yet