Files
rent-a-car/RentACar/WebApp/Views/Rents/Index.cshtml
ani_konarcheva@abv.bg 9f3b3f88bb migration2
2022-04-08 19:59:21 +03:00

59 lines
1.6 KiB
Plaintext

@model IEnumerable<Data.Entities.Rents>
@{
ViewData["Title"] = "Index";
}
<h1>Rents</h1>
<p>
<a type="button" class="btn btn-primary" asp-action="Create">Rent a car</a>
</p>
@if (this.User.IsInRole("Admin"))
{
<table class="table">
<thead>
<tr>
<th>
Car ID
</th>
<th>
Start Date
</th>
<th>
End Date
</th>
@if (this.User.IsInRole("Admin"))
{
<th>
Actions
</th>
}
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Car.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.StartDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.EndDate)
</td>
@if (this.User.IsInRole("Admin"))
{
<td>
<a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
<a asp-action="Details" asp-route-id="@item.Id">Details</a> |
<a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
</td>
}
</tr>
}
</tbody>
</table>
}