From c9777042c090dc38d825f8eef669991c1a7aeda9 Mon Sep 17 00:00:00 2001
From: Dimitar Byalkov
Date: Fri, 8 Apr 2022 20:55:29 +0300
Subject: [PATCH] Design changes
---
.../WebApp/Controllers/RentsController.cs | 2 +-
RentACar/WebApp/Views/Cars/Create.cshtml | 5 +--
RentACar/WebApp/Views/Cars/Delete.cshtml | 4 +--
RentACar/WebApp/Views/Cars/Details.cshtml | 4 +--
RentACar/WebApp/Views/Cars/Edit.cshtml | 5 +--
RentACar/WebApp/Views/Cars/Index.cshtml | 11 +++---
RentACar/WebApp/Views/Home/Index.cshtml | 23 ++++++++++---
RentACar/WebApp/Views/Rents/Create.cshtml | 6 +---
RentACar/WebApp/Views/Rents/DateSelect.cshtml | 34 -------------------
RentACar/WebApp/Views/Rents/Delete.cshtml | 2 +-
RentACar/WebApp/Views/Rents/Edit.cshtml | 2 +-
RentACar/WebApp/Views/Rents/Index.cshtml | 2 +-
12 files changed, 36 insertions(+), 64 deletions(-)
delete mode 100644 RentACar/WebApp/Views/Rents/DateSelect.cshtml
diff --git a/RentACar/WebApp/Controllers/RentsController.cs b/RentACar/WebApp/Controllers/RentsController.cs
index 9d4d9be..574d066 100644
--- a/RentACar/WebApp/Controllers/RentsController.cs
+++ b/RentACar/WebApp/Controllers/RentsController.cs
@@ -60,7 +60,7 @@ namespace WebApp.Controllers
[HttpPost]
[ValidateAntiForgeryToken]
- public async Task Create([Bind("Id,CarId,StartDate,EndDate,UserId")] Rents rents)
+ public async Task Create([Bind("Id,Car.Id,StartDate,EndDate,UserId")] Rents rents)
{
if (ModelState.IsValid)
{
diff --git a/RentACar/WebApp/Views/Cars/Create.cshtml b/RentACar/WebApp/Views/Cars/Create.cshtml
index f459283..3cac6ec 100644
--- a/RentACar/WebApp/Views/Cars/Create.cshtml
+++ b/RentACar/WebApp/Views/Cars/Create.cshtml
@@ -43,15 +43,12 @@
-
-
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
diff --git a/RentACar/WebApp/Views/Cars/Delete.cshtml b/RentACar/WebApp/Views/Cars/Delete.cshtml
index c917cf8..800c5c4 100644
--- a/RentACar/WebApp/Views/Cars/Delete.cshtml
+++ b/RentACar/WebApp/Views/Cars/Delete.cshtml
@@ -51,7 +51,7 @@
diff --git a/RentACar/WebApp/Views/Cars/Details.cshtml b/RentACar/WebApp/Views/Cars/Details.cshtml
index f0ad8cc..8dc386f 100644
--- a/RentACar/WebApp/Views/Cars/Details.cshtml
+++ b/RentACar/WebApp/Views/Cars/Details.cshtml
@@ -49,6 +49,6 @@
diff --git a/RentACar/WebApp/Views/Cars/Edit.cshtml b/RentACar/WebApp/Views/Cars/Edit.cshtml
index 5300704..1c0f852 100644
--- a/RentACar/WebApp/Views/Cars/Edit.cshtml
+++ b/RentACar/WebApp/Views/Cars/Edit.cshtml
@@ -45,15 +45,12 @@
-
-
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
diff --git a/RentACar/WebApp/Views/Cars/Index.cshtml b/RentACar/WebApp/Views/Cars/Index.cshtml
index acbd785..42a1892 100644
--- a/RentACar/WebApp/Views/Cars/Index.cshtml
+++ b/RentACar/WebApp/Views/Cars/Index.cshtml
@@ -11,7 +11,7 @@
Add new car
}
-
+
|
@@ -35,9 +35,12 @@
|
Daily price
|
-
- Actions
- |
+ @if (this.User.IsInRole("Admin"))
+ {
+
+ Actions
+ |
+ }
diff --git a/RentACar/WebApp/Views/Home/Index.cshtml b/RentACar/WebApp/Views/Home/Index.cshtml
index 2b4d8b1..cd7e982 100644
--- a/RentACar/WebApp/Views/Home/Index.cshtml
+++ b/RentACar/WebApp/Views/Home/Index.cshtml
@@ -3,11 +3,24 @@
}
-
Welcome, @User.Identity.Name
-
-
Manage cars
- @if (this.User.IsInRole("Admin"))
+ @if (this.User.Identity.Name != null)
{
-
Manage rents
+
Welcome, @User.Identity.Name
+
+ @if (this.User.IsInRole("Admin"))
+ {
+
Manage cars
+
Manage rents
+ }
+ else
+ {
+
See all cars
+
Rent a car
+ }
+ }
+ else
+ {
+
Welcome to LuminousCars
+
Please register or login to access the system.
}
diff --git a/RentACar/WebApp/Views/Rents/Create.cshtml b/RentACar/WebApp/Views/Rents/Create.cshtml
index 0e221a3..bf11e3a 100644
--- a/RentACar/WebApp/Views/Rents/Create.cshtml
+++ b/RentACar/WebApp/Views/Rents/Create.cshtml
@@ -27,16 +27,12 @@
-
-
-
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
diff --git a/RentACar/WebApp/Views/Rents/DateSelect.cshtml b/RentACar/WebApp/Views/Rents/DateSelect.cshtml
deleted file mode 100644
index f986344..0000000
--- a/RentACar/WebApp/Views/Rents/DateSelect.cshtml
+++ /dev/null
@@ -1,34 +0,0 @@
-@model Data.Entities.Rents
-
-@{
- ViewData["Title"] = "DateSelect";
-}
-
-
-Rent a car
-Select dates
-
-
-
-@section Scripts {
- @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
-}
\ No newline at end of file
diff --git a/RentACar/WebApp/Views/Rents/Delete.cshtml b/RentACar/WebApp/Views/Rents/Delete.cshtml
index f4c1e6a..ef68092 100644
--- a/RentACar/WebApp/Views/Rents/Delete.cshtml
+++ b/RentACar/WebApp/Views/Rents/Delete.cshtml
@@ -51,6 +51,6 @@
diff --git a/RentACar/WebApp/Views/Rents/Edit.cshtml b/RentACar/WebApp/Views/Rents/Edit.cshtml
index 0e32495..2b0d787 100644
--- a/RentACar/WebApp/Views/Rents/Edit.cshtml
+++ b/RentACar/WebApp/Views/Rents/Edit.cshtml
@@ -28,7 +28,7 @@
diff --git a/RentACar/WebApp/Views/Rents/Index.cshtml b/RentACar/WebApp/Views/Rents/Index.cshtml
index afc1c5f..ca7e01d 100644
--- a/RentACar/WebApp/Views/Rents/Index.cshtml
+++ b/RentACar/WebApp/Views/Rents/Index.cshtml
@@ -11,7 +11,7 @@
@if (this.User.IsInRole("Admin"))
{
-