Design changes

This commit is contained in:
Dimitar Byalkov
2022-04-08 20:55:29 +03:00
parent 9f3b3f88bb
commit c9777042c0
12 changed files with 36 additions and 64 deletions

View File

@@ -60,7 +60,7 @@ namespace WebApp.Controllers
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Id,CarId,StartDate,EndDate,UserId")] Rents rents) public async Task<IActionResult> Create([Bind("Id,Car.Id,StartDate,EndDate,UserId")] Rents rents)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {

View File

@@ -43,15 +43,12 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" /> <input type="submit" value="Create" class="btn btn-primary" />
<a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts { @section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");} @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
} }

View File

@@ -51,7 +51,7 @@
<form asp-action="Delete"> <form asp-action="Delete">
<input type="hidden" asp-for="Id" /> <input type="hidden" asp-for="Id" />
<input type="submit" value="Delete" class="btn btn-danger" /> | <input type="submit" value="Delete" class="btn btn-danger" />
<a asp-action="Index">Back to List</a> <a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</form> </form>
</div> </div>

View File

@@ -49,6 +49,6 @@
</dl> </dl>
</div> </div>
<div> <div>
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> | <a type="button" class="btn btn-primary" asp-action="Edit" asp-route-id="@Model.Id">Edit</a>
<a asp-action="Index">Back to List</a> <a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</div> </div>

View File

@@ -45,15 +45,12 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="submit" value="Save" class="btn btn-primary" /> <input type="submit" value="Save" class="btn btn-primary" />
<a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts { @section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");} @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
} }

View File

@@ -11,7 +11,7 @@
<a type="button" class="btn btn-primary" asp-action="Create">Add new car</a> <a type="button" class="btn btn-primary" asp-action="Create">Add new car</a>
} }
</p> </p>
<table class="table"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th> <th>
@@ -35,9 +35,12 @@
<th> <th>
Daily price Daily price
</th> </th>
<th> @if (this.User.IsInRole("Admin"))
Actions {
</th> <th>
Actions
</th>
}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@@ -3,11 +3,24 @@
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Welcome, @User.Identity.Name</h1> @if (this.User.Identity.Name != null)
<br />
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Cars" asp-action="Index">Manage cars</a>
@if (this.User.IsInRole("Admin"))
{ {
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Rents" asp-action="Index">Manage rents</a> <h1 class="display-4">Welcome, @User.Identity.Name</h1>
<br />
@if (this.User.IsInRole("Admin"))
{
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Cars" asp-action="Index">Manage cars</a>
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Rents" asp-action="Index">Manage rents</a>
}
else
{
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Cars" asp-action="Index">See all cars</a>
<a type="button" class="btn btn-primary" asp-area="" asp-controller="Rents" asp-action="Index">Rent a car</a>
}
}
else
{
<h1>Welcome to LuminousCars</h1>
<h2>Please register or login to access the system.</h2>
} }
</div> </div>

View File

@@ -27,16 +27,12 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="submit" value="Create" class="btn btn-primary" /> <input type="submit" value="Create" class="btn btn-primary" />
<a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts { @section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");} @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}

View File

@@ -1,34 +0,0 @@
@model Data.Entities.Rents
@{
ViewData["Title"] = "DateSelect";
}
<h1>Rent a car</h1>
<h2>Select dates</h2>
<div class="row">
<div class="col-md-4">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="StartDate" class="control-label"></label>
<input asp-for="StartDate" class="form-control" />
<span asp-validation-for="StartDate" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EndDate" class="control-label"></label>
<input asp-for="EndDate" class="form-control" />
<span asp-validation-for="EndDate" class="text-danger"></span>
</div>
<div class="form-group">
<input type="submit" value="Findiew" class="btn btn-primary" />
</div>
</form>
</div>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -51,6 +51,6 @@
<form asp-action="Delete"> <form asp-action="Delete">
<input type="hidden" asp-for="Id" /> <input type="hidden" asp-for="Id" />
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="Delete" class="btn btn-danger" />
<a class="btn btn-secondary" asp-action="Index">Back to List</a> <a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</form> </form>
</div> </div>

View File

@@ -28,7 +28,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<input class="btn btn-primary" type="submit" value="Save" /> <input class="btn btn-primary" type="submit" value="Save" />
<a class="btn btn-secondary" asp-action="Index">Back to List</a> <a type="button" class="btn btn-secondary" asp-action="Index">Back to List</a>
</div> </div>
</form> </form>
</div> </div>

View File

@@ -11,7 +11,7 @@
</p> </p>
@if (this.User.IsInRole("Admin")) @if (this.User.IsInRole("Admin"))
{ {
<table class="table"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th> <th>