веб-кар

This commit is contained in:
aleksandr chegodaev 2024-04-30 22:23:33 +04:00
parent 2842234e6d
commit 03b010bbed
11 changed files with 374 additions and 24 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
@ -6,4 +6,10 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CarCenterBusinessLogics\CarCenterBusinessLogics.csproj" />
<ProjectReference Include="..\CarCenterContracts\CarCenterContracts.csproj" />
<ProjectReference Include="..\CarCenterDatabaseImplement\CarCenterDatabaseImplement.csproj" />
</ItemGroup>
</Project>

View File

@ -1,12 +1,21 @@
using CarCenterImplementerAPP.Models;
using CarCenterManagerAPP.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using CarCenterBusinessLogic.BusinessLogics;
using CarCenterContracts.BusinessLogicsContracts;
using CarCenterContracts.ViewModels;
using CarCenterDataModels.Models;
using CarCenterDataBaseImplement.Models;
namespace CarCenterImplementerAPP.Controllers
namespace ImplementerApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IEmployeeLogic _employeeLogic;
private readonly IManagerLogic _managerLogic;
private readonly IPreSaleWorkLogic _presaleworkLogic;
private readonly ISaleLogic _saleLogic;
public HomeController(ILogger<HomeController> logger)
{
@ -17,16 +26,119 @@ namespace CarCenterImplementerAPP.Controllers
{
return View();
}
public IActionResult Enter()
{
return View();
}
public IActionResult Register()
{
return View();
}
public IActionResult IndexEmployee()
{
List<EmployeeViewModel> Employee = new List<EmployeeViewModel>();
new EmployeeViewModel
{
Id = 1,
EmployeeFIO = "EmployeeFIO1",
EmployeePost = "EmployeePost1",
EmployeeSalary = 500.0M,
ManagerId = 1,
EmployeeSales = new()
};
new EmployeeViewModel
{
Id = 2,
EmployeeFIO = "EmployeeFIO2",
EmployeePost = "EmployeePost2",
EmployeeSalary = 5100.0M,
ManagerId = 2,
EmployeeSales = new()
};
return View(Employee);
}
public IActionResult CreateEmployee()
{
return View();
}
public IActionResult IndexPreSaleWork()
{
return View(new List<PreSaleWorkViewModel>());
}
public IActionResult CreatePreSaleWork()
{
var work = new List<PreSaleWorkViewModel>();
work.Add(new PreSaleWorkViewModel
{
Id = 1,
PreSaleWorkType = "PreSaleWork1",
PreSaleWorkDate = DateTime.Now,
PreSaleWorkPrice = 50000.9M,
ManagerId = 1,
CompletionsId = 1,
PreSaleWorkSales = new()
});
work.Add(new PreSaleWorkViewModel
{
Id = 2,
PreSaleWorkType = "PreSaleWork2",
PreSaleWorkDate = DateTime.Now,
PreSaleWorkPrice = 100000.9M,
ManagerId = 2,
CompletionsId = 2,
PreSaleWorkSales = new()
});
return View(work);
}
public IActionResult IndexSale()
{
return View(new List<SaleViewModel>());
}
public IActionResult CreateSale()
{
List<SaleViewModel> Sales = new List<SaleViewModel>();
new SaleViewModel
{
Id = 1,
SaleName = "Sale1",
SalePrice = 100.5M,
SaleDate = DateTime.Now,
ManagerId = 1,
};
new SaleViewModel
{
Id = 2,
SaleName = "Sale2",
SalePrice = 600.0M,
SaleDate = DateTime.Now,
ManagerId = 2,
};
return View(Sales);
}
public IActionResult Privacy()
{
return View();
}
public IActionResult ReportsMenu()
{
return View();
}
public IActionResult SalesInspectionsReport()
{
return View(new List<SalesInspectionsReportViewModel>());
}
public IActionResult SalesPeriodReport()
{
return View(new List<SalesPeriodReportViewModel>());
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
}

View File

@ -0,0 +1,56 @@
@using CarCenterContracts.ViewModels
@model List<CarSalesViewModel>
@{
ViewData["Title"] = "CreateBonus";
}
<div class="text-center">
<h2 class="display-4">Создание осмотра</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8"><input type="text" name="title" id="title" /></div>
</div>
<div class="container">
<div>CarSales</div>
<div class="table-responsive-lg">
<table id="CarSalessTable" class="display">
<thead>
<tr>
<th>Выбор</th>
<th>Название</th>
</tr>
</thead>
<tbody>
@foreach (var CarSales in Model)
{
<tr>
<td>
<input type="checkbox" name="carcales" value="@CarSales.Id" />
</td>
<td>@CarSales.CarBrand</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.js"></script>
<script>
$(document).ready(function () {
$('#CarsTable').DataTable();
});
</script>

View File

@ -0,0 +1,21 @@
@{
ViewData["Title"] = "Enter";
}
<div class="text-center">
<h2 class="display-4">Вход в приложение</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Вход" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -3,6 +3,13 @@
}
<div class="text-center">
<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>
<h1 class="display-4">Приложение "Автоцентр "Корыто". Исполнитель"</h1>
<div class="list-group">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexCars">Автомобили</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Клиенты</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="IndexBonus">Бонусы</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ReportsMenu">Список отчетов</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
</div>
</div>

View File

@ -0,0 +1,63 @@
@using CarCenterContracts.ViewModels
@model List<BonusViewModel>
@{
ViewData["Title"] = "Bonus";
}
<div class="text-center">
<h1 class="display-4">Бонусы</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table">
<thead>
<tr>
<th>
Марка автомобили
</th>
<th>
Клиент
</th>
<th>
Накопленные бонусы
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.BonusName)
</td>
<td>
@Html.DisplayFor(modelItem => item.BonusCost)
</td>
<td>
@Html.DisplayFor(modelItem => item.BonusDate)
</td>
<td>
<a asp-action="CreateBonus" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
</td>
<td>
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,59 @@
@using CarCenterContracts.ViewModels
@model List<CarSalesViewModel>
@{
ViewData["Title"] = "Cars";
}
<div class="text-center">
<h1 class="display-4">Автомобили в наличии</h1>
</div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Производитель машины
</th>
<th>
Модель машины
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.CarBrand)
</td>
<td>
@Html.DisplayFor(modelItem => item.CarModel)
</td>
<td>
@Html.DisplayFor(modelItem => item.CarCost)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,29 @@
@{
ViewData["Title"] = "Register";
}
<div class="text-center">
<h2 class="display-4">Регистрация</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="name" /></div>
</div>
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Почта:</div>
<div class="col-8"><input type="email" name="email" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Регистрация" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,11 @@
@{
ViewData["Title"] = "Report Menu";
}
<div class="text-center">
<h1 class="display-4">Список создания отчетов</h1>
<div class="list-group">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CarsPeriodReport">Отчет по клиентам</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CarsPreSaleWorkReport">Отчет по автомобилям</a>
</div>
</div>

View File

@ -3,30 +3,16 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - CarCenterImplementerAPP</title>
<title>@ViewData["Title"] - CarCenterManagerAPP</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/CarCenterImplementerAPP.styles.css" asp-append-version="true" />
<link rel="stylesheet" href="~/CarCenterManagerAPP.styles.css" asp-append-version="true" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">CarCenterImplementerAPP</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<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>
</ul>
</div>
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Исполнитель Автоцентр "Корыто"</a>
</div>
</nav>
</header>
@ -38,7 +24,7 @@
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - CarCenterImplementerAPP - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2024 - Исполнитель Автоцентр "Корыто" - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>