mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
61 lines
1.5 KiB
Plaintext
61 lines
1.5 KiB
Plaintext
@using Packt.Shared
|
|
@model IEnumerable<Customer>
|
|
|
|
<h2>@ViewData["Title"]</h2>
|
|
|
|
@if (TempData["error-message"] is not null)
|
|
{
|
|
<p class="alert alert-danger">Error! @TempData["error-message"]</p>
|
|
}
|
|
@if (TempData["success-message"] is not null)
|
|
{
|
|
<p class="alert alert-success">Congratulations! @TempData["success-message"]</p>
|
|
}
|
|
|
|
<a asp-controller="Home" asp-action="AddCustomer"
|
|
class="btn btn-outline-primary">Add Customer</a>
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Company Name</th>
|
|
<th>Contact Name</th>
|
|
<th>Address</th>
|
|
<th>Phone</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if (Model is not null)
|
|
{
|
|
@foreach (Customer c in Model)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => c.CompanyName)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => c.ContactName)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => c.Address)
|
|
@Html.DisplayFor(modelItem => c.City)
|
|
@Html.DisplayFor(modelItem => c.Region)
|
|
@Html.DisplayFor(modelItem => c.Country)
|
|
@Html.DisplayFor(modelItem => c.PostalCode)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => c.Phone)
|
|
</td>
|
|
<td>
|
|
<a asp-controller="Home"
|
|
asp-action="DeleteCustomer"
|
|
asp-route-customerid="@c.CustomerId"
|
|
class="btn btn-outline-danger">Delete</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
}
|
|
</tbody>
|
|
</table>
|