forked from wanderer/pwt-0x01-ng
47 lines
1.5 KiB
Plaintext
47 lines
1.5 KiB
Plaintext
@model ProductViewModel
|
|
@{
|
|
ViewData["Title"] = "Products";
|
|
}
|
|
<h2>@ViewData["Title"]</h2>
|
|
<h3>@ViewData["Message"]</h3>
|
|
|
|
<p>All product data.</p>
|
|
<a asp-action="Create">Create new item</a>
|
|
<br/><br/>
|
|
|
|
@{
|
|
if (Model?.Products != null && Model.Products.Count > 0) {
|
|
<table id="product_table" class="table table-responsive table-striped table-bordered">
|
|
<tr>
|
|
<th class="col-sm">@Html.DisplayNameFor(model => model.Products[0].id)</th>
|
|
<th class="col-sm-2">@Html.DisplayNameFor(model => model.Products[0].Name)</th>
|
|
<th class="col-sm-1">@Html.DisplayNameFor(model => model.Products[0].Price)</th>
|
|
<th class="col-sm-3">@Html.DisplayNameFor(model => model.Products[0].Description)</th>
|
|
<th class="col-sm-3">@Html.DisplayNameFor(model => model.Products[0].ImageSrc)</th>
|
|
<th class="col-sm-2">@Html.DisplayNameFor(model => model.Products[0].ImageAlt)</th>
|
|
<th class="col-sm">Edit</th>
|
|
<th class="col-sm">Delete</th>
|
|
</tr>
|
|
@{
|
|
foreach (var item in Model.Products)
|
|
{
|
|
<tr>
|
|
<td class="col-sm">@item.id</td>
|
|
<td class="col-sm-2">@item.Name</td>
|
|
<td class="col-sm-1">@item.Price</td>
|
|
<td class="col-sm-3">@item.Description</td>
|
|
<td class="col-sm-3">@item.ImageSrc</td>
|
|
<td class="col-sm-2">@item.ImageAlt</td>
|
|
<td class="col-sm"><a asp-action="Edit" asp-route-id="@item.id">Edit</a></td>
|
|
<td class="col-sm"><a asp-action="Delete" asp-route-id="@item.id" onclick="return item_deletion_confirmation();">Delete</a></td>
|
|
</tr>
|
|
}
|
|
}
|
|
</table>
|
|
}
|
|
else
|
|
{
|
|
<h2>No products to show</h2>
|
|
}
|
|
}
|