forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewData.cshtml
40 lines (39 loc) · 1.47 KB
/
ViewData.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@page
@model ViewDataModel
@{
ViewData["Title"] = "View Items";
}
<form method="POST">
<table class="itemlist">
<caption>Item List</caption>
<thead>
<tr><th> </th><th>Id</th><th>Price</th><th>Description</th></tr>
</thead>
@foreach (var item in Model.Items)
{
<tr>
@if (Model.Editing == item.Id)
{
<td>
<button class="link" type="submit" asp-page-handler="Update" asp-route-id="@item.Id">Update</button>
<button class="link" type="submit" asp-page-handler="CancelUpdate">Cancel</button>
</td>
<td>@item.Id</td>
<td><input type="number" min="0" step="any" name="Price" value="@item.Price" /></td>
<td><input type="text" name="Description" value="@item.Description" /></td>
}
else
{
<td>
<button class="link" type="submit" asp-page-handler="Edit" asp-route-id="@item.Id">Edit</button>
<button class="link" type="submit" asp-page-handler="Delete" asp-route-id="@item.Id">Delete</button>
</td>
<td>@item.Id</td>
<td>@item.Price</td>
<td>@item.Description</td>
}
</tr>
}
</table>
</form>
<a href="~/InsertItem">Add New Item</a>