изменила бд
This commit is contained in:
parent
8e9ecbf3b3
commit
c3d5dcbc78
CarCenter
CarCenterAdministratorApp
CarCenterContracts/ViewModels
CarCenterDataBaseImplement
@ -18,13 +18,15 @@ namespace CarCenterAdministratorApp.Controllers
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly ICarLogic _car;
|
||||
private readonly IEquipmentLogic _equipment;
|
||||
private readonly IInspectionLogic _inspection;
|
||||
|
||||
|
||||
public HomeController(ILogger<HomeController> logger, ICarLogic car, IEquipmentLogic equipment)
|
||||
public HomeController(ILogger<HomeController> logger, ICarLogic car, IEquipmentLogic equipment, IInspectionLogic inspection)
|
||||
{
|
||||
_logger = logger;
|
||||
_car = car;
|
||||
_equipment = equipment;
|
||||
_inspection = inspection;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
@ -226,23 +228,6 @@ namespace CarCenterAdministratorApp.Controllers
|
||||
Response.Redirect("ListCars");
|
||||
}
|
||||
|
||||
/* [HttpGet]
|
||||
public CarViewModel? GetCar(int carId)
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
var result = APIClient.GetRequest<CarViewModel>($"api/main/getcar?carid={carId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
var brandCar = result.BrandCar;
|
||||
var model = result.Model;
|
||||
|
||||
return result;
|
||||
}*/
|
||||
public IActionResult ListEquipments()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
@ -270,7 +255,7 @@ namespace CarCenterAdministratorApp.Controllers
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(equipmentName) || equipmentPrice <= 0 || cars.Length == 0)
|
||||
{
|
||||
@ -281,43 +266,192 @@ namespace CarCenterAdministratorApp.Controllers
|
||||
{
|
||||
equipmentCars.Add(id, _car.ReadElement(new CarSearchModel { Id = id }));
|
||||
}
|
||||
_equipment.Create(new EquipmentBindingModel
|
||||
|
||||
APIClient.PostRequest("api/main/CreateEquipment", new EquipmentBindingModel
|
||||
{
|
||||
AdministratorId = APIClient.Administrator.Id,
|
||||
EquipmentName = equipmentName,
|
||||
EquipmentPrice = equipmentPrice,
|
||||
EquipmentCars = equipmentCars
|
||||
EquipmentPrice = equipmentPrice
|
||||
});
|
||||
for (int i = 0; i < cars.Length; i++)
|
||||
{
|
||||
APIClient.PostRequest("api/main/AddCarToEquipment", Tuple.Create(
|
||||
new EquipmentSearchModel() { EquipmentName = equipmentName },
|
||||
new CarViewModel() { Id = cars[i] }
|
||||
));
|
||||
}
|
||||
Response.Redirect("ListEquipments");
|
||||
}
|
||||
|
||||
|
||||
public IActionResult UpdateEquipment()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Equipments = APIClient.GetRequest<List<EquipmentViewModel>>($"api/main/getequipmentlist?administratorId={APIClient.Administrator.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateEquipment(int equipment, string equipmentName, double equipmentPrice)
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(equipmentName))
|
||||
{
|
||||
throw new Exception("Введите название");
|
||||
}
|
||||
if (string.IsNullOrEmpty(equipmentPrice.ToString()))
|
||||
{
|
||||
throw new Exception("Введите стоимость");
|
||||
}
|
||||
APIClient.PostRequest("api/main/updateequipment", new EquipmentBindingModel
|
||||
{
|
||||
Id = equipment,
|
||||
AdministratorId = APIClient.Administrator.Id,
|
||||
EquipmentName = equipmentName,
|
||||
EquipmentPrice = equipmentPrice
|
||||
});
|
||||
Response.Redirect("ListEquipments");
|
||||
}
|
||||
public IActionResult UpdateEquipment()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public IActionResult ListInspections()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IActionResult DeleteEquipment()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Equipments = APIClient.GetRequest<List<EquipmentViewModel>>($"api/main/getequipmentlist?administratorId={APIClient.Administrator.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteEquipment(int equipment)
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/main/deleteequipment", new EquipmentBindingModel
|
||||
{
|
||||
Id = equipment
|
||||
});
|
||||
Response.Redirect("ListEquipments");
|
||||
}
|
||||
|
||||
public IActionResult ListInspections()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest<List<InspectionViewModel>>($"api/main/getInspectionlist?administratorId={APIClient.Administrator.Id}"));
|
||||
}
|
||||
public IActionResult CreateInspection()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var list = _car.ReadList(new CarSearchModel { AdministratorId = APIClient.Administrator.Id });
|
||||
var simpCar = list.Select(x => new { CarId = x.Id, BrandCar = x.BrandCar });
|
||||
ViewBag.Cars = new MultiSelectList(simpCar, "CarId", "BrandCar");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void CreateInspection(string inspectionName, DateTime inspectionDate, int[] cars)
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(inspectionName) || cars.Length == 0)
|
||||
{
|
||||
throw new Exception("Введите название и стоимость");
|
||||
}
|
||||
Dictionary<int, ICarModel> inspectionCars = new Dictionary<int, ICarModel>();
|
||||
foreach (int id in cars)
|
||||
{
|
||||
inspectionCars.Add(id, _car.ReadElement(new CarSearchModel { Id = id }));
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/main/Createinspection", new InspectionBindingModel
|
||||
{
|
||||
AdministratorId = APIClient.Administrator.Id,
|
||||
InspectionName = inspectionName,
|
||||
InspectionDate = inspectionDate
|
||||
});
|
||||
for (int i = 0; i < cars.Length; i++)
|
||||
{
|
||||
APIClient.PostRequest("api/main/AddCarToInspection", Tuple.Create(
|
||||
new InspectionSearchModel() { InspectionName = inspectionName },
|
||||
new CarViewModel() { Id = cars[i] }
|
||||
));
|
||||
}
|
||||
Response.Redirect("ListInspections");
|
||||
}
|
||||
public IActionResult UpdateInspection()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Inspections = APIClient.GetRequest<List<InspectionViewModel>>($"api/main/getinspectionlist?administratorId={APIClient.Administrator.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void UpdateInspection(int inspection, string inspectionName, DateTime inspectionDate, int[] cars)
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
if (string.IsNullOrEmpty(inspectionName))
|
||||
{
|
||||
throw new Exception("Введите название");
|
||||
}
|
||||
APIClient.PostRequest("api/main/updateinspection", new InspectionBindingModel
|
||||
{
|
||||
Id = inspection,
|
||||
AdministratorId = APIClient.Administrator.Id,
|
||||
InspectionName = inspectionName,
|
||||
InspectionDate = inspectionDate
|
||||
});
|
||||
Response.Redirect("ListInspections");
|
||||
}
|
||||
|
||||
public IActionResult DeleteInspection()
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Inspections = APIClient.GetRequest<List<InspectionViewModel>>($"api/main/getinspectionlist?administratorId={APIClient.Administrator.Id}");
|
||||
return View();
|
||||
}
|
||||
public IActionResult AddCarToEquipment()
|
||||
|
||||
[HttpPost]
|
||||
public void DeleteInspection(int inspection)
|
||||
{
|
||||
if (APIClient.Administrator == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/main/deleteinspection", new InspectionBindingModel
|
||||
{
|
||||
Id = inspection
|
||||
});
|
||||
Response.Redirect("ListInspections");
|
||||
}
|
||||
|
||||
public IActionResult AddCarToEquipment()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
@ -17,6 +17,10 @@ builder.Services.AddTransient<ICarLogic, CarLogic>();
|
||||
builder.Services.AddTransient<IEquipmentStorage, EquipmentStorage>();
|
||||
builder.Services.AddTransient<IEquipmentLogic, EquipmentLogic>();
|
||||
|
||||
|
||||
builder.Services.AddTransient<IInspectionStorage, InspectionStorage>();
|
||||
builder.Services.AddTransient<IInspectionLogic, InspectionLogic>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
@{
|
||||
@{
|
||||
ViewData["Title"] = "CreateInspection";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание осмотра</h2>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Название осмотра</label>
|
||||
@ -11,14 +15,19 @@
|
||||
name="inspectionName"
|
||||
class="form-control" />
|
||||
<br>
|
||||
<div class="u-form-email u-form-group u-label-top">
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-2">Дата осмотра</label>
|
||||
<input type="datetime-local"
|
||||
placeholder="Выберите дату начала"
|
||||
name="bookingDate"
|
||||
class="form-control" />
|
||||
</div>
|
||||
<input type="date"
|
||||
placeholder="Выберите дату осмотра"
|
||||
name="inspectionDate"
|
||||
class="form-control" />
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Машины: </label>
|
||||
<div>
|
||||
@Html.ListBox("cars", (MultiSelectList)ViewBag.Cars, new { @class = "form-control", size = "10" })
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
@{
|
||||
ViewData["Title"] = "DeleteCar";
|
||||
ViewData["Title"] = "DeleteCar";
|
||||
}
|
||||
<form method="post">
|
||||
<div class="container d-flex justify-content-center align-items-center0">
|
||||
|
@ -7,11 +7,11 @@
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Комплектации: </label>
|
||||
|
||||
<select id="equipment" name="equipment" class="form-control" asp-items="@(new SelectList(@ViewBag.Equipments, "Id", "EquipmentName"))"></select>
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
<input type="submit" value="Удалить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Осмотр: </label>
|
||||
|
||||
<select id="inspection" name="inspection" class="form-control" asp-items="@(new SelectList(@ViewBag.Inspections, "Id", "InspectionName"))"></select>
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
|
@ -3,7 +3,7 @@
|
||||
@model List<CarViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "ListCars";
|
||||
ViewData["Title"] = "ListCars";
|
||||
}
|
||||
|
||||
<section class="u-clearfix u-section-1" id="sec-e38b">
|
||||
|
@ -59,9 +59,6 @@
|
||||
<a asp-area="" asp-controller="Home" asp-action="DeleteEquipment"
|
||||
class="btn btn-outline-dark text-center d-flex justify-content-md-center">Удалить</a>
|
||||
|
||||
<a asp-area="" asp-controller="Home" asp-action="AddCarToEquipment"
|
||||
style="padding: 10 px"
|
||||
class="btn btn-outline-dark text-center d-flex justify-content-md-center">Добавить машину</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,15 +21,28 @@
|
||||
Номер
|
||||
</th>
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
Название осмотра
|
||||
Название
|
||||
</th>
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
Имя сотрудника
|
||||
Дата
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="u-table-body">
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr style="height: 75px">
|
||||
<td class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
|
||||
@Html.DisplayFor(modelItem => item.InspectionName)
|
||||
</td>
|
||||
<td class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
|
||||
@Html.DisplayFor(modelItem => item.InspectionDate)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -46,9 +59,6 @@
|
||||
<a asp-area="" asp-controller="Home" asp-action="DeleteInspection"
|
||||
class="btn btn-outline-dark text-center d-flex justify-content-md-center">Удалить</a>
|
||||
|
||||
<a asp-area="" asp-controller="Home" asp-action="AddCarToInspection"
|
||||
style="padding: 10 px"
|
||||
class="btn btn-outline-dark text-center d-flex justify-content-md-center">Добавить машины</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2,7 +2,7 @@
|
||||
@using CarCenterDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "UpdateCar";
|
||||
ViewData["Title"] = "UpdateCar";
|
||||
}
|
||||
<form method="post">
|
||||
<div class="container d-flex justify-content-center align-items-center">
|
||||
@ -25,7 +25,7 @@
|
||||
id="model"
|
||||
placeholder="Введите модель"
|
||||
name="model"
|
||||
class="form-control"/>
|
||||
class="form-control" />
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
@ -36,15 +36,15 @@
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var car = $('#car').val();
|
||||
if (car) {
|
||||
var car = $('#car').val();
|
||||
if (car) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetCar",
|
||||
data: { carId: car },
|
||||
data: { carId: car },
|
||||
success: function (result) {
|
||||
$('#brandCar').val(result.BrandCar);
|
||||
$('#model').val(result.Model);
|
||||
@ -53,8 +53,8 @@
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#car').on('change', function () {
|
||||
check();
|
||||
$('#car').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
@ -1,56 +1,64 @@
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@using CarCenterContracts.ViewModels;
|
||||
@using CarCenterDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "UpdateEquipment";
|
||||
}
|
||||
|
||||
|
||||
<form method="post">
|
||||
<div class="container d-flex justify-content-center align-items-center">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Комплектации: </label>
|
||||
|
||||
<select id="equipment" name="equipment" class="form-control" asp-items="@(new SelectList(@ViewBag.Equipments, "Id", "EquipmentName"))"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Название комплектации</label>
|
||||
<input type="text"
|
||||
id="equipmentName"
|
||||
id="equipmentName"
|
||||
placeholder="Введите название конференции"
|
||||
name="equipmenName"
|
||||
name="equipmentName"
|
||||
class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-2">Цена комплектации</label>
|
||||
<label class="u-label u-text-custom-color-1 u-label-2">Стоимость комплектации</label>
|
||||
<input type="number"
|
||||
id="equipmenPrice"
|
||||
placeholder="Введите цену комплектации"
|
||||
name="equipmenPrice"
|
||||
id="equipmentPrice"
|
||||
placeholder="Введите стоимость комплектации"
|
||||
name="equipmentPrice"
|
||||
class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="u-table u-table-responsive u-table-1">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Машина для комплектаций</label>
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr style="height: 44px">
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
Бренд
|
||||
</th>
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
Модель
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="u-table-body" id="table-elements">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var equipment = $('#equipment').val();
|
||||
if (equipment) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetEquipment",
|
||||
data: { equipmentId: equipment },
|
||||
success: function (result) {
|
||||
$('#equipmentName').val(result.equipmentName);
|
||||
$('#equipmentPrice').val(result.equipmentPrice);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#equipment').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
@ -2,44 +2,63 @@
|
||||
@using CarCenterDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "UpdateInspection";
|
||||
ViewData["Title"] = "UpdateInspection";
|
||||
}
|
||||
|
||||
<form method="post">
|
||||
<div class="container">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="inspection">Осмотры:</label>
|
||||
<div class="container d-flex justify-content-center align-items-center">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Осмотры: </label>
|
||||
<select id="inspection" name="inspection" class="form-control" asp-items="@(new SelectList(@ViewBag.Inspections, "Id", "InspectionName"))"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Название Осмотра</label>
|
||||
<input type="text"
|
||||
id="inspectionName"
|
||||
placeholder="Введите название осмотра"
|
||||
name="inspectionName"
|
||||
class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="u-label u-text-custom-color-1 u-label-2">Дата осмотра</label>
|
||||
<input type="date"
|
||||
id="inspectionDate"
|
||||
placeholder="Выберите дату осмотра"
|
||||
name="inspectionDate"
|
||||
class="form-control" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="employee">Сотрудник:</label>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="inspectionName">Название осмотра:</label>
|
||||
<input type="text" id="inspectionName" name="inspectionName" class="form-control" placeholder="Введите название осмотра">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Машины для осмотров:</label>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Бренд машины</th>
|
||||
<th>Модель</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table-elements" class="u-table-body">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Добавить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts
|
||||
{
|
||||
<script>
|
||||
function check() {
|
||||
var inspection = $('#inspection').val();
|
||||
if (inspection) {
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/Home/GetInspection",
|
||||
data: { inspectionId: inspection },
|
||||
success: function (result) {
|
||||
$('#inspectionName').val(result.inspectionName);
|
||||
$('#inspectionDate').val(result.inspectionDate);
|
||||
$('#table-elements').html(result.item2);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
check();
|
||||
$('#inspection').on('change', function () {
|
||||
check();
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
@ -20,5 +21,12 @@ namespace CarCenterContracts.ViewModels
|
||||
public int AdministratorId { get; set; }
|
||||
public int? PreSaleWorkId { get; set; }
|
||||
public Dictionary<int, ICarModel> EquipmentCars { get; set; } = new();
|
||||
}
|
||||
public EquipmentViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public EquipmentViewModel(Dictionary<int, CarViewModel> EquipmentCars)
|
||||
{
|
||||
this.EquipmentCars = EquipmentCars.ToDictionary(x => x.Key, x => x.Value as ICarModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CarCenterContracts.ViewModels
|
||||
{
|
||||
@ -16,11 +18,19 @@ namespace CarCenterContracts.ViewModels
|
||||
public string InspectionName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата осмотра")]
|
||||
public DateTime? InspectionDate { get; set; }
|
||||
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
|
||||
public DateTime? InspectionDate { get; set; }
|
||||
public int AdministratorId { get; set; }
|
||||
public int? EmployeeId { get; set; }
|
||||
|
||||
public string EmployeeName { get; set; } = string.Empty;
|
||||
public Dictionary<int, ICarModel> InspectionCars { get; set; } = new();
|
||||
}
|
||||
public InspectionViewModel() { }
|
||||
|
||||
[JsonConstructor]
|
||||
public InspectionViewModel(Dictionary<int, CarViewModel> InspectionCars)
|
||||
{
|
||||
this.InspectionCars = InspectionCars.ToDictionary(x => x.Key, x => x.Value as ICarModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
561
CarCenter/CarCenterDataBaseImplement/Migrations/20240526165712_WithoutCount.Designer.cs
generated
Normal file
561
CarCenter/CarCenterDataBaseImplement/Migrations/20240526165712_WithoutCount.Designer.cs
generated
Normal file
@ -0,0 +1,561 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CarCenterDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CarCenterDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CarCenterDataBase))]
|
||||
[Migration("20240526165712_WithoutCount")]
|
||||
partial class WithoutCount
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Administrator", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AdministratorEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("AdministratorFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("AdministratorLogin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("AdministratorNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("AdministratorPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Administrators");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Car", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdministratorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BrandCar")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Model")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AdministratorId");
|
||||
|
||||
b.ToTable("Cars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("EmployeeFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ManagerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Specialization")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManagerId");
|
||||
|
||||
b.ToTable("Employees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.EmployeeSale", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("EmployeeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SaleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EmployeeId");
|
||||
|
||||
b.HasIndex("SaleId");
|
||||
|
||||
b.ToTable("EmployeeSales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Equipment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdministratorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("EquipmentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("EquipmentPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int?>("PreSaleWorkId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AdministratorId");
|
||||
|
||||
b.HasIndex("PreSaleWorkId");
|
||||
|
||||
b.ToTable("Equipments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.EquipmentCar", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CarId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("EquipmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CarId");
|
||||
|
||||
b.HasIndex("EquipmentId");
|
||||
|
||||
b.ToTable("EquipmentCars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Inspection", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AdministratorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("EmployeeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("InspectionDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("InspectionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AdministratorId");
|
||||
|
||||
b.HasIndex("EmployeeId");
|
||||
|
||||
b.ToTable("Inspections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.InspectionCar", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CarId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("InspectionId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CarId");
|
||||
|
||||
b.HasIndex("InspectionId");
|
||||
|
||||
b.ToTable("InspectionCars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Manager", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ManagerEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ManagerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ManagerLogin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ManagerNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ManagerPassword")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Managers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWork", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ManagerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("PreSaleWorkPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("PreSaleWorkType")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManagerId");
|
||||
|
||||
b.ToTable("PreSaleWorks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWorkSale", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("PreSaleWorkId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SaleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PreSaleWorkId");
|
||||
|
||||
b.HasIndex("SaleId");
|
||||
|
||||
b.ToTable("PreSaleWorkSales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Sale", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ManagerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("SaleDate")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("SalePrice")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManagerId");
|
||||
|
||||
b.ToTable("Sales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Car", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Administrator", "Administrator")
|
||||
.WithMany("Cars")
|
||||
.HasForeignKey("AdministratorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Administrator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Manager", "Manager")
|
||||
.WithMany("Employees")
|
||||
.HasForeignKey("ManagerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manager");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.EmployeeSale", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Employee", "Employee")
|
||||
.WithMany("Sales")
|
||||
.HasForeignKey("EmployeeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Sale", "Sale")
|
||||
.WithMany("EmployeeSales")
|
||||
.HasForeignKey("SaleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Employee");
|
||||
|
||||
b.Navigation("Sale");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Equipment", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Administrator", "Administrator")
|
||||
.WithMany("Equipments")
|
||||
.HasForeignKey("AdministratorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.PreSaleWork", "PreSaleWork")
|
||||
.WithMany("Equipments")
|
||||
.HasForeignKey("PreSaleWorkId");
|
||||
|
||||
b.Navigation("Administrator");
|
||||
|
||||
b.Navigation("PreSaleWork");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.EquipmentCar", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Car", "Car")
|
||||
.WithMany("EquipmentCars")
|
||||
.HasForeignKey("CarId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Equipment", "Equipment")
|
||||
.WithMany("Cars")
|
||||
.HasForeignKey("EquipmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Car");
|
||||
|
||||
b.Navigation("Equipment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Inspection", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Administrator", "Administrator")
|
||||
.WithMany("Inspections")
|
||||
.HasForeignKey("AdministratorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Employee", "Employee")
|
||||
.WithMany("Inspections")
|
||||
.HasForeignKey("EmployeeId");
|
||||
|
||||
b.Navigation("Administrator");
|
||||
|
||||
b.Navigation("Employee");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.InspectionCar", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Car", "Car")
|
||||
.WithMany("InspectionCar")
|
||||
.HasForeignKey("CarId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Inspection", "Inspection")
|
||||
.WithMany("Cars")
|
||||
.HasForeignKey("InspectionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Car");
|
||||
|
||||
b.Navigation("Inspection");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWork", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Manager", "Manager")
|
||||
.WithMany("PreSaleWorks")
|
||||
.HasForeignKey("ManagerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manager");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWorkSale", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.PreSaleWork", "PreSaleWork")
|
||||
.WithMany("Sales")
|
||||
.HasForeignKey("PreSaleWorkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Sale", "Sale")
|
||||
.WithMany("PreSaleWorkSale")
|
||||
.HasForeignKey("SaleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PreSaleWork");
|
||||
|
||||
b.Navigation("Sale");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Sale", b =>
|
||||
{
|
||||
b.HasOne("CarCenterDataBaseImplement.Models.Manager", "Manager")
|
||||
.WithMany("Sales")
|
||||
.HasForeignKey("ManagerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manager");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Administrator", b =>
|
||||
{
|
||||
b.Navigation("Cars");
|
||||
|
||||
b.Navigation("Equipments");
|
||||
|
||||
b.Navigation("Inspections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Car", b =>
|
||||
{
|
||||
b.Navigation("EquipmentCars");
|
||||
|
||||
b.Navigation("InspectionCar");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Employee", b =>
|
||||
{
|
||||
b.Navigation("Inspections");
|
||||
|
||||
b.Navigation("Sales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Equipment", b =>
|
||||
{
|
||||
b.Navigation("Cars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Inspection", b =>
|
||||
{
|
||||
b.Navigation("Cars");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Manager", b =>
|
||||
{
|
||||
b.Navigation("Employees");
|
||||
|
||||
b.Navigation("PreSaleWorks");
|
||||
|
||||
b.Navigation("Sales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.PreSaleWork", b =>
|
||||
{
|
||||
b.Navigation("Equipments");
|
||||
|
||||
b.Navigation("Sales");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CarCenterDataBaseImplement.Models.Sale", b =>
|
||||
{
|
||||
b.Navigation("EmployeeSales");
|
||||
|
||||
b.Navigation("PreSaleWorkSale");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CarCenterDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class WithoutCount : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Count",
|
||||
table: "EquipmentCars");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Count",
|
||||
table: "EquipmentCars",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -171,9 +171,6 @@ namespace CarCenterDataBaseImplement.Migrations
|
||||
b.Property<int>("CarId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("EquipmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
|
@ -14,8 +14,6 @@ namespace CarCenterDataBaseImplement.Models
|
||||
public int EquipmentId { get; set; }
|
||||
public int CarId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
public virtual Equipment Equipment { get; set; } = new();
|
||||
public virtual Car Car { get; set; } = new();
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ namespace CarCenterDataBaseImplement.Models
|
||||
EmployeeId = model.EmployeeId,
|
||||
AdministratorId = model.AdministratorId,
|
||||
InspectionName = model.InspectionName,
|
||||
Cars = model.InspectionCars.Select(x => new InspectionCar
|
||||
InspectionDate = model.InspectionDate,
|
||||
Cars = model.InspectionCars.Select(x => new InspectionCar
|
||||
{
|
||||
Car = context.Cars.First(y => y.Id == x.Key),
|
||||
}).ToList()
|
||||
|
Loading…
x
Reference in New Issue
Block a user