Merge branch 'Worker_Raspaev' into Storekeeper

This commit is contained in:
dasha 2023-04-03 18:25:30 +04:00
commit bab1b63323
17 changed files with 432 additions and 693 deletions

View File

@ -30,9 +30,21 @@ namespace HardwareShopContracts.BusinessLogicsContracts
return list;
}
public CommentViewModel? ReadElement(CommentSearchModel model)
public PurchaseSearchModel? ReadElement(PurchaseSearchModel model)
{
throw new NotImplementedException();
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
_logger.LogInformation("ReadElement. Id:{Id}", model.Id);
var element = _purchaseStorage.GetElement(model);
if (element == null)
{
_logger.LogWarning("ReadElement element not found");
return null;
}
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
public bool DeliveryPurchase(PurchaseBindingModel model)
@ -78,6 +90,11 @@ namespace HardwareShopContracts.BusinessLogicsContracts
public bool Update(PurchaseBindingModel model)
{
if (model.PurchaseStatus == PurchaseStatus.Выдан)
{
_logger.LogWarning("Update status operation failed");
return false;
}
CheckModel(model);
if (_purchaseStorage.Update(model) == null)
{
@ -89,6 +106,11 @@ namespace HardwareShopContracts.BusinessLogicsContracts
public bool Delete(PurchaseBindingModel model)
{
if (model.PurchaseStatus == PurchaseStatus.Выдан)
{
_logger.LogWarning("Delete status operation failed");
return false;
}
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
if (_purchaseStorage.Delete(model) == null)

View File

@ -65,17 +65,11 @@ namespace HardwareShopClientApp.Controllers
[HttpPost]
public void Builds(int id)
{
Response.Redirect("Build");
Response.Redirect("LinkPurchase");
}
[HttpGet]
public IActionResult Build()
{
return View();
}
[HttpGet]
public IActionResult linkingBuild()
public IActionResult LinkPurchase()
{
return View();
}

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Магазин компьютерной техники</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="~/HardwareShopClientApp.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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Покупки</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Сборки</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Комментарии</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">Получение списка</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">Отчёт</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer b-xtjzatmnc3="" class="border-top footer text-muted">
<div class="container">
© 2023 - "Ты ж программист" - Магазин компьютерной техники <a href="/Home/Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@ -1,78 +0,0 @@

@using HardwareShopContracts.ViewModels
@{
ViewData["Title"] = "Build";
}
@model List<ComponentViewModel>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Комплектующие</h2>
</div>
<div class="col-sm-3">
<label class="form-label">Название сборки</label>
<input type="text" class="form-control" name="buildName">
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Комплектующее
</th>
<th>
Цена
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<button type="submit" class="btn btn-primary mt-3 px-4">Save</button>
</form>

View File

@ -1,81 +1,61 @@
@using HardwareShopContracts.ViewModels
@{
@{
ViewData["Title"] = "Builds";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
@model List<BuildViewModel>
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Сборки</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Цена
</th>
<th>
Название
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="submit" class="btn btn-primary btn-lg mb-5">Привязать сборку</button>
</div>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Сборка</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<label class="form-label">Название</label>
<input type="text" class="form-control">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Добавить</button>
</div>
</div>
</nav>
</header>
}
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Сборки</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="submit" class="btn btn-primary btn-lg mb-5">Добавить</button>
<button type="submit" class="btn btn-primary btn-lg mb-5">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Привязать сборку</button>
</div>
</form>
</div>
</form>

View File

@ -1,105 +1,70 @@
@using HardwareShopContracts.ViewModels
@{
@{
ViewData["Title"] = "Comments";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
@model List<CommentViewModel>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Комментарии</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Текст
</th>
<th>
Название сборки к которой относиться комментарий
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Комментарий</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
</div>
</nav>
</header>
}
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Комментарии</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Текст
</th>
<th>
Название сборки
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
</div>
<!-- Модальное окно -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Комментарий</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
<div class="modal-body">
<div>
<label class="form-label">Сборка</label>
<select class="form-select">
<option value="1">Сборка 1</option>
<option value="2">Сборка 2</option>
</select>
</div>
<div class="modal-body">
<div>
<label class="form-label">Сборка</label>
<select class="form-select" name="role">
<option value="1">Сборка 1</option>
<option value="2">Сборка 2</option>
</select>
</div>
<div>
<label class="form-label">Текст</label>
<input type="text" class="form-control" name="text">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Сохранить</button>
<div>
<label class="form-label">Текст</label>
<input type="text" class="form-control">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Сохранить</button>
</div>
</div>
</div>
</form>
</div>
</form>

View File

@ -0,0 +1,84 @@

@{
ViewData["Title"] = "LinkPurchase";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Выбранные покупки</h2>
</div>
<div>
<label class="form-label">Сборка</label>
<select class="form-select" name="role">
<option value="1">Сборка 1</option>
<option value="2">Сборка 2</option>
</select>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="submit" class="btn btn-primary btn-lg mb-5">Сохранить</button>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Покупка</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<div>
<label class="form-label">Покупка</label>
<select class="form-select">
<option value="1">Покупка 1</option>
<option value="2">Покупка 2</option>
</select>
</div>
<div>
<label class="form-label">Количество</label>
<input type="number" class="form-control">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Сохранить</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -1,39 +1,5 @@
@{
ViewData["Title"] = "MainWorker";
}
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}

View File

@ -1,73 +1,37 @@
@using HardwareShopContracts.ViewModels
@{
@{
ViewData["Title"] = "Purchase";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
@model List<GoodViewModel>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Товары</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название товара
</th>
<th>
Цена
</th>
<th>
Логин пользователя
</th>
<th>
Количество
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Товары</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название товара
</th>
<th>
Цена
</th>
<th>
Логин пользователя
</th>
<th>
Количество
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
@ -75,9 +39,8 @@
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Сохрванить</button>
</div>
<!-- Модальное окно -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
@ -88,14 +51,14 @@
<div class="modal-body">
<div>
<label class="form-label">Товар</label>
<select class="form-select" name="role">
<select class="form-select">
<option value="1">Товар 1</option>
<option value="2">Товар 2</option>
</select>
</div>
<div>
<label class="form-label">Количество</label>
<input type="number" class="form-control" name="count">
<input type="number" class="form-control">
</div>
</div>
<div class="modal-footer">
@ -105,5 +68,4 @@
</div>
</div>
</div>
</form>

View File

@ -1,73 +1,37 @@
@using HardwareShopContracts.ViewModels
@{
@{
ViewData["Title"] = "Purchases";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
@model List<PurchaseViewModel>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form method="post" class="d-flex justify-content-evenly">
<div class="col-sm-8">
<div class="text-center">
<h2 class="display-4">Покупки</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="col-sm-8">
<div class="text-center">
<h2 class="display-4">Покупки</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">

View File

@ -1,51 +1,15 @@
@using HardwareShopContracts.ViewModels
@{
@{
ViewData["Title"] = "WorkerReport";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form method="post" class="d-flex flex-column align-items-center">
<div class="col-sm-3">
<label class="form-label">С</label>
<input type="date" class="form-control" name="dateFrom">
<label class="form-label">По</label>
<input type="date" class="form-control" name="dateTo">
</div>
<button type="submit" class="btn btn-primary mt-3 px-4">Вывод на страницу</button>
<button type="submit" class="btn btn-primary mt-3 px-4">Отправить на почту</button>
</form>
<form method="post" class="d-flex flex-column align-items-center">
<div class="col-sm-3">
<label class="form-label">С</label>
<input type="date" class="form-control" name="dateFrom">
<label class="form-label">По</label>
<input type="date" class="form-control" name="dateTo">
</div>
<button type="submit" class="btn btn-primary mt-3 px-4">Вывод на страницу</button>
<button type="submit" class="btn btn-primary mt-3 px-4">Отправить на почту</button>
</form>

View File

@ -1,116 +0,0 @@

@using HardwareShopContracts.ViewModels
@{
ViewData["Title"] = "linkingBuild";
}
@model List<GoodViewModel>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Выбранные покупки</h2>
</div>
<div>
<label class="form-label">Сборка</label>
<select class="form-select" name="role">
<option value="1">Сборка 1</option>
<option value="2">Сборка 2</option>
</select>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Комплектующее
</th>
<th>
Цена
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="submit" class="btn btn-primary btn-lg mb-5">Save</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Изменить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
</div>
<!-- Модальное окно -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Покупка</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<div>
<label class="form-label">Покупка</label>
<select class="form-select" name="purchase">
<option value="1">Покупка 1</option>
<option value="2">Покупка 2</option>
</select>
</div>
<div>
<label class="form-label">Количество</label>
<input type="number" class="form-control" name="count">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Сохранить</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -1,106 +1,68 @@
@using HardwareShopContracts.ViewModels
@{
ViewData["Title"] = "listComponents";
@{
ViewData["Title"] = "ListComponents";
Layout = "~/Views/Shared/_LayoutWorker.cshtml";
}
@model List<PurchaseViewModel>
@section Header {
<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">Магазин компьютерной техники "Ты ж программист"</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="Worker" asp-action="Purchases">Purchases</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Builds">Builds</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="Comments">Comments</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="listComponents">listComponents</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="WorkerReport">WorkerReport</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Worker" asp-action="linkingBuild">linkingBuild</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
}
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Покупки</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<form method="post" class="d-flex justify-content-evenly">
<div class=" col-sm-8">
<div class="text-center">
<h2 class="display-4">Покупки</h2>
</div>
<div class="text-center" name="id">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Дата оплаты
</th>
<th>
Сумма
</th>
<th>
Статус
</th>
<th>
Логин пользователя
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Сохранить в doc формате</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Сохранить в xls формате</button>
</div>
<div class="text-center d-flex flex-column mt-5">
<button type="button" class="btn btn-primary btn-lg mb-5" data-bs-toggle="modal" data-bs-target="#exampleModal">Добавить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Удалить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Обновить</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Сохранить в doc формате</button>
<button type="button" class="btn btn-primary btn-lg mb-5">Сохранить в xls формате</button>
</div>
<!-- Модальное окно -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Покупка</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<div>
<label class="form-label">Покупка</label>
<select class="form-select" name="role">
<option value="1">Покупка 1</option>
<option value="2">Покупка 2</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Добавить</button>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Покупка</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<div>
<label class="form-label">Покупка</label>
<select class="form-select">
<option value="1">Покупка 1</option>
<option value="2">Покупка 2</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Закрыть</button>
<button type="button" class="btn btn-primary">Добавить</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -7,7 +7,7 @@ namespace HardwareShopContracts.BusinessLogicsContracts
public interface IPurchaseLogic
{
List<PurchaseViewModel>? ReadList(PurchaseSearchModel? model);
CommentViewModel? ReadElement(CommentSearchModel model);
PurchaseSearchModel? ReadElement(PurchaseSearchModel model);
bool Create(PurchaseBindingModel model);
bool Update(PurchaseBindingModel model);
bool Delete(PurchaseBindingModel model);

View File

@ -7,5 +7,7 @@ namespace HardwareShopContracts.SearchModels
public int? Id { get; set; }
public int? UserId { get; set; }
public DateTime? DatePurchase { get; set; }
}
}

View File

@ -9,7 +9,7 @@ namespace HardwareShopContracts.ViewModels
[DisplayName("Цена")]
public double Price { get; set; }
[DisplayName("Название компонента")]
[DisplayName("Название Сборки")]
public string BuildName { get; set; } = string.Empty;
[DisplayName("Логин пользователя")]

View File

@ -25,15 +25,25 @@ namespace HardwareShopDatabaseImplement.Implements.Worker
public List<PurchaseViewModel> GetFilteredList(PurchaseSearchModel model)
{
using var context = new HardwareShopDatabase();
if (!model.UserId.HasValue)
if (!model.UserId.HasValue && !model.DatePurchase.HasValue)
{
return new();
}
if (model.UserId.HasValue)
{
return context.Purchases
.Include(x => x.Goods)
.ThenInclude(x => x.Good)
.Include(x => x.User)
.Where(x => x.UserId == model.UserId)
.Select(x => x.GetViewModel)
.ToList();
}
return context.Purchases
.Include(x => x.Goods)
.ThenInclude(x => x.Good)
.Include(x => x.User)
.Where(x => x.UserId == model.UserId)
.Where(x => x.DatePurchase == model.DatePurchase)
.Select(x => x.GetViewModel)
.ToList();
}