Completed cars
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,16 +11,21 @@ namespace Data.Entities
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public string Brand { get; set; }
|
public string Brand { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public string Model { get; set; }
|
public string Model { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public int CountPassengerSeats { get; set; }
|
public int CountPassengerSeats { get; set; }
|
||||||
|
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public decimal PriceForDay { get; set; }
|
public decimal PriceForDay { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace WebApp.Controllers
|
|||||||
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Create([Bind("Id,Brand,Model,Year,CountPassengerSeats,Description,PriceForDay")] Car car)
|
public async Task<IActionResult> Create([Bind("Id, Brand, Model, Year, CountPassengerSeats, Description, PriceForDay")] Car car)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ namespace WebApp.Controllers
|
|||||||
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Edit(int id, [Bind("Id,Brand,Model,Year,CountPassengerSeats,Description,PriceForDay")] Car car)
|
public async Task<IActionResult> Edit(int id, [Bind("Id, Brand, Model, Year, CountPassengerSeats, Description, PriceForDay")] Car car)
|
||||||
{
|
{
|
||||||
if (id != car.Id)
|
if (id != car.Id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Description" class="control-label"></label>
|
<label asp-for="Description" class="control-label"></label>
|
||||||
|
<a style="color:red;"> *optional</a>
|
||||||
<input asp-for="Description" class="form-control" />
|
<input asp-for="Description" class="form-control" />
|
||||||
<span asp-validation-for="Description" class="text-danger"></span>
|
<span asp-validation-for="Description" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,12 +24,9 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Cars" asp-action="Index">Cars</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Cars" asp-action="Index">Cars</a>
|
||||||
</li>
|
</li>
|
||||||
@if (this.User.IsInRole("Admin"))
|
|
||||||
{
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Rents" asp-action="Index">Rents</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Rents" asp-action="Index">Rents</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
|
||||||
</ul>
|
</ul>
|
||||||
<partial name="_LoginPartial" />
|
<partial name="_LoginPartial" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
@if (SignInManager.IsSignedIn(User))
|
@if (SignInManager.IsSignedIn(User))
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name</a>
|
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello, @User.Identity.Name</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
|
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
|
||||||
|
|||||||
Reference in New Issue
Block a user