Page design, remove migration, edit foreign key

This commit is contained in:
Dimitar Byalkov
2022-04-08 19:22:12 +03:00
parent 6ab09ad841
commit 7a888a4c2e
16 changed files with 163 additions and 1214 deletions

View File

@@ -7,44 +7,53 @@
<h1>Rents</h1>
<p>
<a asp-action="Create">Create New</a>
<a type="button" class="btn btn-primary" asp-action="Create">Rent a car</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.CarId)
</th>
<th>
@Html.DisplayNameFor(model => model.StartDate)
</th>
<th>
@Html.DisplayNameFor(model => model.EndDate)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.CarId)
</td>
<td>
@Html.DisplayFor(modelItem => item.StartDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.EndDate)
</td>
@if (this.User.IsInRole("Admin"))
@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)
{
<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>
<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>
}
</tr>
}
</tbody>
</table>
</tbody>
</table>
}