CarsController
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Data
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=.;Database=RentACar;Integrated Security=true;");
|
||||
optionsBuilder.UseSqlServer("Server=.\\SQLEXPRESS;Database=RentACar;Integrated Security=true;");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@
|
||||
<input asp-for="Input.PhoneNumber" class="form-control" />
|
||||
<span asp-validation-for="Input.PhoneNumber" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Input.PersonalNumber"></label>
|
||||
<input asp-for="Input.PersonalNumber" class="form-control" />
|
||||
<span asp-validation-for="Input.PersonalNumber " class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Input.Password"></label>
|
||||
<input asp-for="Input.Password" class="form-control" />
|
||||
|
||||
@@ -65,6 +65,9 @@ namespace WebApp.Areas.Identity.Pages.Account
|
||||
[Display(Name = "Phone")]
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
[Display(Name = "Personal number")]
|
||||
public string PersonalNumber { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
@@ -89,7 +92,7 @@ namespace WebApp.Areas.Identity.Pages.Account
|
||||
ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
var user = new User { Id = Guid.NewGuid().ToString(), UserName = Input.Username, Email = Input.Email, FirstName = Input.FirstName, LastName = Input.LastName, PhoneNumber = Input.PhoneNumber };
|
||||
var user = new User { Id = Guid.NewGuid().ToString(), UserName = Input.Username, Email = Input.Email, FirstName = Input.FirstName, LastName = Input.LastName, PhoneNumber = Input.PhoneNumber, PersonalNumber = Input.PersonalNumber };
|
||||
var result = await _userManager.CreateAsync(user, Input.Password);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
|
||||
<h1>Create</h1>
|
||||
|
||||
<h4>Create new car</h4>
|
||||
<h1>Create new vehicle</h1>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
@@ -29,13 +27,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="CountPassengerSeats" class="control-label"></label>
|
||||
<select asp-for="CountPassengerSeats" class="form-control">
|
||||
<option> 3 </option>
|
||||
<option> 4 </option>
|
||||
<option> 5 </option>
|
||||
<option> 6 </option>
|
||||
<option> 7 </option>
|
||||
</select>
|
||||
<input asp-for="CountPassengerSeats" class="form-control" />
|
||||
<span asp-validation-for="CountPassengerSeats" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
ViewData["Title"] = "Cars";
|
||||
}
|
||||
|
||||
<h1>Index</h1>
|
||||
<h1>Vehicle</h1>
|
||||
<p>
|
||||
@if (this.User.IsInRole("Admin"))
|
||||
{
|
||||
<a asp-action="Create">New car</a>
|
||||
<a asp-action="Create">Create car</a>
|
||||
}
|
||||
</p>
|
||||
<table class="table">
|
||||
@@ -38,30 +38,33 @@
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Brand)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Model)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Year)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CountPassengerSeats)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Description)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PriceForDay)
|
||||
</td>
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Brand)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Model)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Year)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CountPassengerSeats)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Description)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.PriceForDay)
|
||||
</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>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@{
|
||||
ViewData["Title"] = "Rent a car";
|
||||
ViewData["Title"] = "LuminousCars";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Rent a car</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">LuminousCars</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@@ -20,18 +20,12 @@
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Cars" asp-action="Index">Cars</a>
|
||||
</li>
|
||||
@if (this.User.IsInRole("Admin"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Cars" asp-action="Create">Create Car</a>
|
||||
</li>
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Rents" asp-action="Index">Rents</a>
|
||||
</li>
|
||||
@@ -50,7 +44,7 @@
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2022 - Rent a car - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
© 2022 - LuminousCars
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=.;Database=RentACar;Integrated Security=true;"
|
||||
"DefaultConnection": "Server=.\\SQLEXPRESS;Database=RentACar;Integrated Security=true;"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=.;Database=RentACar;Integrated Security=true;"
|
||||
"DefaultConnection": "Server=.\\SQLEXPRESS;Database=RentACar;Integrated Security=true;"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
|
||||
Reference in New Issue
Block a user