creating car
This commit is contained in:
@@ -21,7 +21,6 @@ namespace WebApp.Controllers
|
|||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Cars
|
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
return View(await _context.Cars.ToListAsync());
|
return View(await _context.Cars.ToListAsync());
|
||||||
@@ -47,6 +46,7 @@ namespace WebApp.Controllers
|
|||||||
|
|
||||||
// GET: Cars/Create
|
// GET: Cars/Create
|
||||||
[Authorize(Roles = "Admin")]
|
[Authorize(Roles = "Admin")]
|
||||||
|
[HttpGet]
|
||||||
public IActionResult Create()
|
public IActionResult Create()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
@@ -69,6 +69,7 @@ namespace WebApp.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET: Cars/Edit/5
|
// GET: Cars/Edit/5
|
||||||
|
[HttpGet]
|
||||||
public async Task<IActionResult> Edit(int? id)
|
public async Task<IActionResult> Edit(int? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
@@ -120,6 +121,7 @@ namespace WebApp.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GET: Cars/Delete/5
|
// GET: Cars/Delete/5
|
||||||
|
[HttpGet]
|
||||||
public async Task<IActionResult> Delete(int? id)
|
public async Task<IActionResult> Delete(int? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
|
|||||||
@@ -23,16 +23,6 @@ namespace API.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
|
||||||
{
|
|
||||||
if(!this.User.Identity.IsAuthenticated)
|
|
||||||
{
|
|
||||||
return Redirect("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<h1>Create</h1>
|
<h1>Create</h1>
|
||||||
|
|
||||||
<h4>Car</h4>
|
<h4>Create new car</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@@ -33,6 +33,8 @@
|
|||||||
<option> 3 </option>
|
<option> 3 </option>
|
||||||
<option> 4 </option>
|
<option> 4 </option>
|
||||||
<option> 5 </option>
|
<option> 5 </option>
|
||||||
|
<option> 6 </option>
|
||||||
|
<option> 7 </option>
|
||||||
</select>
|
</select>
|
||||||
<span asp-validation-for="CountPassengerSeats" class="text-danger"></span>
|
<span asp-validation-for="CountPassengerSeats" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@model IEnumerable<Data.Entities.Car>
|
@model IEnumerable<Data.Entities.Car>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Index";
|
ViewData["Title"] = "Cars";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>Index</h1>
|
<h1>Index</h1>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Rent a car";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Welcome</h1>
|
<h1 class="display-4">Welcome</h1>
|
||||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">API</a>
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Rent a car</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||||
aria-expanded="false" aria-label="Toggle navigation">
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
<footer class="border-top footer text-muted">
|
<footer class="border-top footer text-muted">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
© 2022 - API - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
© 2022 - Rent a car - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user