Закончил неисправность

This commit is contained in:
2024-04-30 14:59:16 +04:00
parent 4631e69353
commit c858bed0ad
13 changed files with 243 additions and 186 deletions

View File

@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using ServiceStationContracts.ViewModels;
using ServiceStationExecutorApp.Models;
using System.Collections.Generic;
using System.Diagnostics;
namespace ServiceStationExecutorApp.Controllers
@@ -73,10 +74,40 @@ namespace ServiceStationExecutorApp.Controllers
ViewBag.Cars = new List<CarViewModel>();
return View();
}
public IActionResult UpdateDefect()
{
ViewBag.Defects = new List<DefectViewModel>();
return View();
}
public IActionResult CreateCar()
{
return View();
}
public IActionResult CreateDefect()
{
return View();
}
public IActionResult AddCarToDefect()
{
var defect = new DefectViewModel
{
Id = 1,
DefectType = "type1",
DefectPrice = 1000.0,
ExecutorId = 1
};
var car = new CarViewModel
{
Id = 1,
CarNumber = "111",
CarBrand = "lamba"
};
List<DefectViewModel> defects = new List<DefectViewModel>();
List <CarViewModel> cars = new List<CarViewModel>();
defects.Add(defect);
cars.Add(car);
return View(Tuple.Create(defects, cars));
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()

View File

@@ -0,0 +1,53 @@
@using ServiceStationContracts.ViewModels;
@using ServiceStationDataModels.Models;
@{
ViewData["Title"] = "AddCarToDefect";
}
@model Tuple<List<DefectViewModel>, List<CarViewModel>>
<div class="container">
<h2>Добавление машин к неисправностям:</h2>
<form method="post">
<div class="form-group">
<label for="defect">Выберите неисправность</label>
<select id="defect" name="defect" class="form-control">
@foreach (var defect in Model.Item1)
{
<option value="@defect.Id">@Html.DisplayFor(modelItem => defect.DefectType)</option>
}
</select>
</div>
<div class="form-group">
<label for="car">Выберите машины</label>
<table class="table mb-0">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Номер</th>
<th scope="col">Марка</th>
</tr>
</thead>
<tbody>
@foreach (var car in Model.Item2)
{
<tr>
<td class="align-middle">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="car[]" value="@car.Id" id="@car.Id">
</div>
</td>
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarNumber)</td>
<td class="align-middle">@Html.DisplayFor(modelItem => car.CarBrand)</td>
</tr>
}
</tbody>
</table>
</div>
<br>
<div>
<input type="submit" value="Добавить" class="btn btn-secondary" />
</div>
</form>
</div>

View File

@@ -7,25 +7,16 @@
<form method="post">
<div class="w-25 container justify-content-center align-items-center">
<div class="form-group py-2">
<label class="u-label u-text-custom-color-1 u-label-1">Номер машины</label>
<input type="text"
id="carNumber"
placeholder="Введите номер машины"
name="carNumber"
class="form-control" />
<label>Номер машины</label>
<input type="text" id="carNumber" placeholder="Введите номер машины" name="carNumber" class="form-control" />
</div>
<div class="form-group py-2">
<label class="u-label u-text-custom-color-1 u-label-2">Марка машины</label>
<input type="text"
id="carBrand"
placeholder="Введите марку машины"
name="carBrand"
class="form-control"
step="1" />
<label>Марка машины</label>
<input type="text" id="carBrand" placeholder="Введите марку машины" name="carBrand" class="form-control" step="1" />
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-secondary text-center d-flex justify-content-md-center" />
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</form>

View File

@@ -0,0 +1,22 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
ViewData["Title"] = "CreateDefect";
}
<form method="post">
<div class="w-25 container justify-content-center align-items-center">
<div class="form-group py-2">
<label>Тип неисправности</label>
<input type="text" id="defectType" placeholder="Введите тип неисправности" name="defectType" class="form-control" />
</div>
<div class="form-group py-2">
<label>Цена неисправности</label>
<input type="number" min="100" step="100" id="defectPrice" placeholder="Введите цену" name="defectPrice" class="form-control" />
</div>
<br>
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</form>

View File

@@ -8,12 +8,12 @@
<div class="container d-flex justify-content-center align-items-center0 w-25">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Машины: </label>
<label>Машины: </label>
<select id="car" name="car" class="form-control" asp-items="@(new SelectList(@ViewBag.Cars, "Id", "CarNumber", "CarBrand"))"></select>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-secondary text-center d-flex justify-content-md-center" />
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</div>

View File

@@ -5,15 +5,15 @@
ViewData["Title"] = "DeleteDefect";
}
<form method="post">
<div class="container d-flex justify-content-center align-items-center0 w-25">
<div class="container d-flex justify-content-center align-items-center w-25">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Неисправности: </label>
<label> Неисправности: </label>
<select id="defect" name="defect" class="form-control" asp-items="@(new SelectList(@ViewBag.Defects, "Id", "DefectType", "DefectPrice"))"></select>
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-secondary text-center d-flex justify-content-md-center" />
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</div>

View File

@@ -9,16 +9,17 @@
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post" class="w-50 mx-auto">
<div class="row my-5">
<div class="row my-4">
<div class="col-4">Номер телефона:</div>
<div class="col-8"><input type="text" name="executorNumber" /></div>
<div class="col-8"><input type="text" class="form-control w-75" name="executorNumber" /></div>
</div>
<div class="row my-5">
<div class="row my-4">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
<div class="col-8"><input type="password" class="form-control w-75" name="password" /></div>
</div>
<div class="row my-5">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btnprimary" /></div>
<div class="row my-4">
<div class="col-5"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btn-secondary w-100" /></div>
<div class="col-3"></div>
</div>
</form>

View File

@@ -5,61 +5,44 @@
ViewData["Title"] = "ListCars";
}
<section class="u-clearfix u-section-1" id="sec-e38b">
<div class="u-clearfix u-sheet u-sheet-1">
<div class="u-clearfix u-layout-wrap u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-row">
<div class="u-container-style u-layout-cell u-size-48 u-layout-cell-1">
<div class="u-container-layout u-container-layout-1">
<div class="u-table u-table-responsive u-table-1">
<table class="table">
<thead class="thead-dark">
<tr style="height: 31px">
<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>
<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.CarNumber)
</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.CarBrand)
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div class="row justify-content-md-center">
<a asp-area="" asp-controller="Home" asp-action="CreateCar"
class="btn btn-secondary text-center d-flex justify-content-md-center col-3">Добавить</a>
&nbsp;
<a asp-area="" asp-controller="Home" asp-action="UpdateCar"
class="btn btn-secondary text-center d-flex justify-content-md-center col-3">Изменить</a>
&nbsp;
<a asp-area="" asp-controller="Home" asp-action="DeleteCar"
class="btn btn-secondary text-center d-flex justify-content-md-center col-3">Удалить</a>
</div>
</div>
</div>
</div>
<section>
<h2>Список машин:</h2>
<table class="table">
<thead class="thead-dark">
<tr style="height: 31px">
<th>
Номер
</th>
<th>
Номер машины
</th>
<th>
Марка машины
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr style="height: 75px">
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.CarNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.CarBrand)
</td>
</tr>
}
</tbody>
</table>
<div class="row justify-content-md-center">
<a asp-controller="Home" asp-action="CreateCar" class="btn btn-secondary text-center col-3">Добавить</a>
&nbsp;
<a asp-controller="Home" asp-action="UpdateCar" class="btn btn-secondary text-center col-3">Изменить</a>
&nbsp;
<a asp-controller="Home" asp-action="DeleteCar" class="btn btn-secondary text-center col-3">Удалить</a>
</div>
</section>

View File

@@ -4,64 +4,46 @@
@{
ViewData["Title"] = "ListDefects";
}
<section class="u-clearfix u-section-1" id="sec-e38b">
<div class="u-clearfix u-sheet u-sheet-1">
<div class="u-clearfix u-layout-wrap u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-row">
<div class="u-container-style u-layout-cell u-size-48 u-layout-cell-1">
<div class="u-container-layout u-container-layout-1">
<div class="u-table u-table-responsive u-table-1">
<table class="table">
<thead class="thead-dark">
<tr style="height: 31px">
<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>
<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.DefectType)
</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.DefectPrice)
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div class="row justify-content-md-center">
<a asp-area="" asp-controller="Home" asp-action="CreateDefect"
class="btn btn-secondary text-center d-flex justify-content-md-center col-2">Добавить</a>
&nbsp;
<a asp-area="" asp-controller="Home" asp-action="UpdateDefect"
class="btn btn-secondary text-center d-flex justify-content-md-center col-2">Изменить</a>
&nbsp;
<a asp-area="" asp-controller="Home" asp-action="AddDefectCar"
class="btn btn-secondary text-center d-flex justify-content-md-center col-2">Добавить машину</a>
&nbsp;
<a asp-area="" asp-controller="Home" asp-action="DeleteDefect"
class="btn btn-secondary text-center d-flex justify-content-md-center col-2">Удалить</a>
</div>
</div>
</div>
</div>
<section>
<h2>Список неисправностей:</h2>
<table class="table">
<thead class="thead-dark">
<tr style="height: 31px">
<th>
Номер
</th>
<th>
Тип неисправности
</th>
<th>
Цена
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr style="height: 75px">
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.DefectType)
</td>
<td>
@Html.DisplayFor(modelItem => item.DefectPrice)
</td>
</tr>
}
</tbody>
</table>
<div class="row justify-content-md-center">
<a asp-controller="Home" asp-action="CreateDefect" class="btn btn-secondary text-center col-2">Добавить</a>
&nbsp;
<a asp-controller="Home" asp-action="UpdateDefect" class="btn btn-secondary text-center col-2">Изменить</a>
&nbsp;
<a asp-controller="Home" asp-action="AddCarToDefect" class="btn btn-secondary text-center col-2">Добавить машину</a>
&nbsp;
<a asp-controller="Home" asp-action="DeleteDefect" class="btn btn-secondary text-center col-2">Удалить</a>
</div>
</section>

View File

@@ -11,23 +11,24 @@
<form method="post" class="w-50 mx-auto p-3">
<div class="row p-3">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="fio" /></div>
<div class="col-8"><input type="text" class="form-control w-75" name="fio" /></div>
</div>
<div class="row p-3">
<div class="col-4">Номер телефона:</div>
<div class="col-8"><input type="text" name="executorNumber" /></div>
<div class="col-8"><input type="text" class="form-control w-75" name="executorNumber" /></div>
</div>
<div class="row p-3">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
<div class="col-8"><input type="password" class="form-control w-75" name="password" /></div>
</div>
<div class="row p-3">
<div class="col-4">Почта:</div>
<div class="col-8"><input type="email" name="email" /></div>
<div class="col-8"><input type="email" class="form-control w-75" name="email" /></div>
</div>
<div class="row p-3">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
<div class="col-5"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-secondary w-100" /></div>
<div class="col-3"></div>
</div>
</form>

View File

@@ -8,29 +8,20 @@
<div class="container d-flex justify-content-center align-items-center w-25">
<div class="card-body ">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Машины: </label>
<label>Машины: </label>
<select id="car" name="car" class="form-control" asp-items="@(new SelectList(@ViewBag.Cars, "Id", "CarNumber", "CarBrand"))"></select>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Номер машины</label>
<input type="text"
id="carNumber"
placeholder="Введите номер машины"
name="carNumber"
class="form-control" />
<label>Номер машины</label>
<input type="text" id="carNumber" placeholder="Введите номер машины" name="carNumber" class="form-control" />
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2">Марка машины</label>
<input type="text"
id="carBrand"
placeholder="Введите марку машины"
name="carBrand"
class="form-control"
step="1" />
<label>Марка машины</label>
<input type="text" id="carBrand" placeholder="Введите марку машины" name="carBrand" class="form-control" step="1" />
</div>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-secondary text-center d-flex justify-content-md-center" />
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</div>

View File

@@ -2,35 +2,37 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
ViewData["Title"] = "UpdateCar";
ViewData["Title"] = "UpdateDefect";
}
<form method="post">
<div class="container d-flex justify-content-center align-items-center w-25">
<div class="container d-flex justify-content-center align-items-center w-50">
<div class="card-body ">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Машины: </label>
<select id="defect" name="defect" class="form-control" asp-items="@(new SelectList(@ViewBag.Cars, "Id", "DefectType", "DefectPrice"))"></select>
<label>Неисправности: </label>
<select id="defect" name="defect" class="form-control" asp-items="@(new SelectList(@ViewBag.Defects, "Id", "DefectType", "DefectPrice"))"></select>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Номер машины</label>
<input type="text"
id="DefectType"
placeholder="Введите номер машины"
name="DefectType"
class="form-control" />
<label>Тип неисравности</label>
<input type="text" id="DefectType" placeholder="Введите тип неисправности" name="DefectType" class="form-control" />
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2">Марка машины</label>
<input type="text"
id="DefectPrice"
placeholder="Введите марку машины"
name="DefectPrice"
class="form-control"
step="1" />
<label>Цена починки</label>
<input type="number" min="100" step="100" id="DefectPrice" placeholder="Введите цену" name="DefectPrice" class="form-control" />
</div>
<table class="table">
<thead>
<tr>
<th scope="col">Номер машины</th>
<th scope="col">Марка машины</th>
</tr>
</thead>
<tbody>
@* полученные машины *@
</tbody>
</table>
<br>
<div class="u-container-layout u-container-layout-2">
<input type="submit" value="Сохранить" class="btn btn-secondary text-center d-flex justify-content-md-center" />
<div>
<input type="submit" value="Сохранить" class="btn btn-secondary text-center" />
</div>
</div>
</div>

View File

@@ -34,7 +34,7 @@
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ListCars">Машины</a>
</li
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ListDefects">Неисправности</a>
</li>