From 34427d59a431d9508de8682c942e2532fff3ac46 Mon Sep 17 00:00:00 2001 From: "ani_konarcheva@abv.bg" Date: Tue, 5 Apr 2022 20:05:03 +0300 Subject: [PATCH] creating car --- RentACar/WebApp/Controllers/CarsController.cs | 4 +++- RentACar/WebApp/Controllers/HomeController.cs | 10 ---------- RentACar/WebApp/Views/Cars/Create.cshtml | 4 +++- RentACar/WebApp/Views/Cars/Index.cshtml | 2 +- RentACar/WebApp/Views/Home/Index.cshtml | 3 +-- RentACar/WebApp/Views/Shared/_Layout.cshtml | 4 ++-- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/RentACar/WebApp/Controllers/CarsController.cs b/RentACar/WebApp/Controllers/CarsController.cs index ca51976..1f1bed3 100644 --- a/RentACar/WebApp/Controllers/CarsController.cs +++ b/RentACar/WebApp/Controllers/CarsController.cs @@ -21,7 +21,6 @@ namespace WebApp.Controllers _context = context; } - // GET: Cars public async Task Index() { return View(await _context.Cars.ToListAsync()); @@ -47,6 +46,7 @@ namespace WebApp.Controllers // GET: Cars/Create [Authorize(Roles = "Admin")] + [HttpGet] public IActionResult Create() { return View(); @@ -69,6 +69,7 @@ namespace WebApp.Controllers } // GET: Cars/Edit/5 + [HttpGet] public async Task Edit(int? id) { if (id == null) @@ -120,6 +121,7 @@ namespace WebApp.Controllers } // GET: Cars/Delete/5 + [HttpGet] public async Task Delete(int? id) { if (id == null) diff --git a/RentACar/WebApp/Controllers/HomeController.cs b/RentACar/WebApp/Controllers/HomeController.cs index 6b36d42..eba0c6e 100644 --- a/RentACar/WebApp/Controllers/HomeController.cs +++ b/RentACar/WebApp/Controllers/HomeController.cs @@ -23,16 +23,6 @@ namespace API.Controllers return View(); } - public IActionResult Privacy() - { - if(!this.User.Identity.IsAuthenticated) - { - return Redirect(""); - } - - return View(); - } - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { diff --git a/RentACar/WebApp/Views/Cars/Create.cshtml b/RentACar/WebApp/Views/Cars/Create.cshtml index 3555bec..24f8184 100644 --- a/RentACar/WebApp/Views/Cars/Create.cshtml +++ b/RentACar/WebApp/Views/Cars/Create.cshtml @@ -6,7 +6,7 @@

Create

-

Car

+

Create new car


@@ -33,6 +33,8 @@ + +
diff --git a/RentACar/WebApp/Views/Cars/Index.cshtml b/RentACar/WebApp/Views/Cars/Index.cshtml index 2937a34..aa1d95b 100644 --- a/RentACar/WebApp/Views/Cars/Index.cshtml +++ b/RentACar/WebApp/Views/Cars/Index.cshtml @@ -1,7 +1,7 @@ @model IEnumerable @{ - ViewData["Title"] = "Index"; + ViewData["Title"] = "Cars"; }

Index

diff --git a/RentACar/WebApp/Views/Home/Index.cshtml b/RentACar/WebApp/Views/Home/Index.cshtml index d2d19bd..dbe286c 100644 --- a/RentACar/WebApp/Views/Home/Index.cshtml +++ b/RentACar/WebApp/Views/Home/Index.cshtml @@ -1,8 +1,7 @@ @{ - ViewData["Title"] = "Home Page"; + ViewData["Title"] = "Rent a car"; }

Welcome

-

Learn about building Web apps with ASP.NET Core.

diff --git a/RentACar/WebApp/Views/Shared/_Layout.cshtml b/RentACar/WebApp/Views/Shared/_Layout.cshtml index 009c8c3..ce2c717 100644 --- a/RentACar/WebApp/Views/Shared/_Layout.cshtml +++ b/RentACar/WebApp/Views/Shared/_Layout.cshtml @@ -11,7 +11,7 @@