Merge pull request 'BACKDEV-409' (#9) from BACKDEV-409 into dev
This commit is contained in:
commit
9f0048fd59
@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreDataba
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputerHardwareStoreREST", "ComputerHardwareStoreREST\ComputerHardwareStoreREST.csproj", "{20E4D287-C0F4-4DAB-B338-349F8B6EA22B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VendorClient", "VendorClient\VendorClient.csproj", "{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoreKeeperClient", "ComputerHardwareStoreStoreKeeperApp\StoreKeeperClient.csproj", "{0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}"
|
||||
EndProject
|
||||
Global
|
||||
@ -51,6 +53,10 @@ Global
|
||||
{0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0FF8FE3D-A38E-40AF-9286-4D7B11ADA785}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BD0D9FB9-7F73-4011-AAC8-D5508EC5EB53}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
143
ComputerHardwareStore/VendorClient/Controllers/HomeController.cs
Normal file
143
ComputerHardwareStore/VendorClient/Controllers/HomeController.cs
Normal file
@ -0,0 +1,143 @@
|
||||
using ComputerHardwareStoreContracts.ViewModels;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
using VendorClient.Models;
|
||||
|
||||
namespace VendorClient.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult AddBuildToPurchase()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Builds()
|
||||
{
|
||||
return View(new List<BuildViewModel>());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult BuildCreate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult BuildDelete()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult BuildUpdate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CommentCreate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CommentDelete()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult CommentUpdate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Comments()
|
||||
{
|
||||
return View(new List<CommentViewModel>());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ProductsList()
|
||||
{
|
||||
return View(new List<BuildViewModel>());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult PurchaseCreate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult PurchaseDelete()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Purchases()
|
||||
{
|
||||
return View(new List<PurchaseViewModel>());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult PurchaseUpdate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Report()
|
||||
{
|
||||
return View(new List<PurchaseViewModel>());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Report(string password)
|
||||
{
|
||||
Response.Redirect("ReportOnly");
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace VendorClient.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
23
ComputerHardwareStore/VendorClient/Program.cs
Normal file
23
ComputerHardwareStore/VendorClient/Program.cs
Normal file
@ -0,0 +1,23 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:27793",
|
||||
"sslPort": 44393
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5194",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7085;http://localhost:5194",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
ComputerHardwareStore/VendorClient/VendorClient.csproj
Normal file
17
ComputerHardwareStore/VendorClient/VendorClient.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ComputerHardwareStoreContracts\ComputerHardwareStoreContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
6
ComputerHardwareStore/VendorClient/VendorClient.http
Normal file
6
ComputerHardwareStore/VendorClient/VendorClient.http
Normal file
@ -0,0 +1,6 @@
|
||||
@VendorClient_HostAddress = http://localhost:5194
|
||||
|
||||
GET {{VendorClient_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
@ -0,0 +1,29 @@
|
||||
@{
|
||||
ViewData["Title"] = "AddBuildToPurchase";
|
||||
}
|
||||
<div class="text-center mb-5">
|
||||
<h2 class="display-4">Добавить сборку в покупку</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Покупка:</div>
|
||||
<div class="col-8 ">
|
||||
<select id="purchaseId" name="purchaseId" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases,"Id", "Date"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Сборка:</div>
|
||||
<div class="col-8">
|
||||
<select id="productId" name="productId" class="form-control" asp-items="@(new SelectList(@ViewBag.Products,"Id", "ProductName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Количество:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="count" id="count" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Добавить" class="btn btn-success" />
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,23 @@
|
||||
@{
|
||||
ViewData["Title"] = "BuildCreate";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4 mb-5">Создать сборку</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="number" id="name" name="name" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="text" id="cost" name="cost" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-8">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-success" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,17 @@
|
||||
@{
|
||||
ViewData["Title"] = "BuildDelete";
|
||||
}
|
||||
<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">
|
||||
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,44 @@
|
||||
@{
|
||||
ViewData["Title"] = "BuildUpdate";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4 mb-5">Обновить сборку</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Сборка:</div>
|
||||
<div class="col-8">
|
||||
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" id="name" name="name" /></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="number" id="cost" name="cost" /></div>
|
||||
</div>
|
||||
<div class="text-center ">
|
||||
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
||||
</div>
|
||||
</form>
|
||||
<<script>
|
||||
$('#build').on('change', function () {
|
||||
getData();
|
||||
});
|
||||
|
||||
function getData() {
|
||||
var buildId = $('#build').val();
|
||||
var buildData = @Html.Raw(Json.Serialize(ViewBag.Builds));
|
||||
var selectedBuild = buildData.find(function (build) {
|
||||
return build.id == buildId;
|
||||
});
|
||||
|
||||
if (selectedBuild) {
|
||||
$("#text").val(selectedBuild.address);
|
||||
$("#cost").val(selectedBuild.cost);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
54
ComputerHardwareStore/VendorClient/Views/Home/Builds.cshtml
Normal file
54
ComputerHardwareStore/VendorClient/Views/Home/Builds.cshtml
Normal file
@ -0,0 +1,54 @@
|
||||
@using ComputerHardwareStoreContracts.ViewModels
|
||||
@model List<BuildViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Builds";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Сборки</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Войдите!</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="BuildCreate">Создать сборку</a>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="BuildUpdate">Изменить сборку</a>
|
||||
<a class="text-decoration-none text-black h5" asp-action="BuildDelete">Удаление магазина</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Название
|
||||
</th>
|
||||
<th>
|
||||
Цена
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var build in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => build.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => build.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => build.Price)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
@ -0,0 +1,29 @@
|
||||
@{
|
||||
ViewData["Title"] = "CommentCreate";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4 mb-5">Создать комментарий</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Заголовок:</div>
|
||||
<div class="col-8"><input type="number" id="title" name="title" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Текст:</div>
|
||||
<div class="col-8"><input type="text" id="text" name="text" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Сборка:</div>
|
||||
<div class="col-8">
|
||||
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-8">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-success" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,17 @@
|
||||
@{
|
||||
ViewData["Title"] = "CommentDelete";
|
||||
}
|
||||
<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">
|
||||
<select id="comment" name="comment" class="form-control" asp-items="@(new SelectList(@ViewBag.Comments,"Id", "Text"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,52 @@
|
||||
@{
|
||||
ViewData["Title"] = "CommentUpdate";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4 mb-5">Обновить комметрарий</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Комментарий:</div>
|
||||
<div class="col-8">
|
||||
<select id="comment" name="comment" class="form-control" asp-items="@(new SelectList(@ViewBag.Comments,"Id", "Text"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Заголовок:</div>
|
||||
<div class="col-8"><input type="text" id="title" name="title" /></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Текст:</div>
|
||||
<div class="col-8"><input type="text" id="text" name="text" /></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Сборка:</div>
|
||||
<div class="col-8">
|
||||
<select id="build" name="build" class="form-control" asp-items="@(new SelectList(@ViewBag.Builds,"Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center ">
|
||||
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
||||
</div>
|
||||
</form>
|
||||
<<script>
|
||||
$('#comment').on('change', function () {
|
||||
getData();
|
||||
});
|
||||
|
||||
function getData() {
|
||||
var commentId = $('#comment').val();
|
||||
var commentData = @Html.Raw(Json.Serialize(ViewBag.Comments));
|
||||
var selectedComment = commentData.find(function (comment) {
|
||||
return comment.id == commentId;
|
||||
});
|
||||
|
||||
if (selectedComment) {
|
||||
$("#title").val(selectedComment.title);
|
||||
$("#text").val(selectedComment.text);
|
||||
$("#build").val(selectedComment.buildId).change(); // <!-- в работоспособности не уверен -->
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -0,0 +1,51 @@
|
||||
@using ComputerHardwareStoreContracts.ViewModels
|
||||
@model List<CommentViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Comments";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Комментарии</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Войди кому говорят!</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="CommentCreate">Создать комментарий</a>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="CommentUpdate">изменить коммментарий</a>
|
||||
<a class="text-decoration-none text-black h5" asp-action="CommentDelete">Удалить комментарий</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Заголовок
|
||||
</th>
|
||||
<th>
|
||||
Текст
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var comment in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => comment.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => comment.Text)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
20
ComputerHardwareStore/VendorClient/Views/Home/Enter.cshtml
Normal file
20
ComputerHardwareStore/VendorClient/Views/Home/Enter.cshtml
Normal file
@ -0,0 +1,20 @@
|
||||
@{
|
||||
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 btnprimary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,7 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<img src="./Images/Logo.jpg" alt="logo">
|
||||
</div>
|
@ -0,0 +1,53 @@
|
||||
@using ComputerHardwareStoreContracts.ViewModels
|
||||
@model List<BuildViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "ProductsList";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Товары по сборкам</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<form method="post">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Войдите!</h3>
|
||||
return;
|
||||
}
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Формат сохранения:</div>
|
||||
<div class="col-8">
|
||||
<input type="radio" id="xlc" name="saveFormat" value="xlc">
|
||||
<label for="xlc">XLC</label>
|
||||
<input type="radio" id="doc" name="saveFormat" value="doc">
|
||||
<label for="doc">DOC</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Выберите файл:</div>
|
||||
<div class="col-8">
|
||||
<input type="file" id="fileSave" name="fileSave" style="display:none">
|
||||
<button type="button" onclick="document.getElementById('fileSave').click();">Выбрать файл</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Выберите сборки:</div>
|
||||
<div class="col-8">
|
||||
<select name="assemblies" multiple>
|
||||
@foreach (var build in Model)
|
||||
{
|
||||
<option value="@build.Id">@build.Name</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-8">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сохранить список" class="btn btn-success" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,43 @@
|
||||
@using ComputerHardwareStoreContracts.ViewModels
|
||||
@model List<ProductViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "PurchaseCreate";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4 mb-5">Создать покупку</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Надо войти!</h3>
|
||||
return;
|
||||
}
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Сумма:</div>
|
||||
<div class="col-8"><input type="number" id="summ" name="summ" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Адрес:</div>
|
||||
<div class="col-8"><input type="text" id="address" name="address" /></div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-4">Товары:</div>
|
||||
<div class="col-8">
|
||||
<select name="products" multiple>
|
||||
@foreach (var product in Model)
|
||||
{
|
||||
<option value="@product.Id">@product.Name</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-5">
|
||||
<div class="col-8">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-success" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</form>
|
@ -0,0 +1,17 @@
|
||||
@{
|
||||
ViewData["Title"] = "PurchaseDelete";
|
||||
}
|
||||
<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">
|
||||
<select id="purchase" name="purchase" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases,"Id", "Data"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Удалить" class="btn btn-danger" />
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,89 @@
|
||||
@{
|
||||
ViewData["Title"] = "PurchaseUpdate";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4 mb-5">Обновить покупку</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Покупка:</div>
|
||||
<div class="col-8">
|
||||
<select id="purchase" name="purchase" class="form-control" asp-items="@(new SelectList(@ViewBag.Purchases,"Id", "Date"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Адрес:</div>
|
||||
<div class="col-8"><input type="text" id="address" name="address" /></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Сумма:</div>
|
||||
<div class="col-8"><input type="number" id="summ" name="summ" /></div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Товары в покупке:</div>
|
||||
<div class="col-8">
|
||||
<table class="tableProducts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Количество</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="purchaseTableProducts">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-4">Сборки в покупке:</div>
|
||||
<div class="col-8">
|
||||
<table class="tableBuilds">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Количество</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="purchaseTableBuilds">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center ">
|
||||
<input type="submit" value="Обновить" class="btn btn-success ps-5 pe-5" />
|
||||
</div>
|
||||
</form>
|
||||
<<script>
|
||||
$('#purchase').on('change', function () {
|
||||
getData();
|
||||
});
|
||||
|
||||
function getData() {
|
||||
var purchaseId = $('#purchase').val();
|
||||
var purchaseData = @Html.Raw(Json.Serialize(ViewBag.Purchases));
|
||||
var selectedPurchase = purchaseData.find(function (purchase) {
|
||||
return purchase.id == purchaseId;
|
||||
});
|
||||
|
||||
if (selectedPurchase) {
|
||||
$("#address").val(selectedPurchase.address);
|
||||
$("#summ").val(selectedPurchase.maxCountCars);
|
||||
fillTableProducts(selectedPurchase.productsAndCounts);
|
||||
fillTableBuilds(selectedPurchase.assembliesAndCounts);
|
||||
}
|
||||
}
|
||||
|
||||
function fillTableProducts(purchaseProducts) {
|
||||
$("#purchaseTableProducts").empty();
|
||||
|
||||
for (var product in purchaseProducts)
|
||||
$("#purchaseTableProducts").append('<tr><td>' + purchaseProducts[product].item1 + '</td><td>' + purchaseProducts[product].item2 + '</td></tr>');
|
||||
}
|
||||
function fillTableBuilds(purchaseBuilds) {
|
||||
$("#purchaseTableBuilds").empty();
|
||||
|
||||
for (var build in purchaseBuilds)
|
||||
$("#purchaseTableBuilds").append('<tr><td>' + purchaseBuilds[build].item1 + '</td><td>' + purchaseBuilds[build].item2 + '</td></tr>');
|
||||
}
|
||||
|
||||
</script>
|
@ -0,0 +1,62 @@
|
||||
@using ComputerHardwareStoreContracts.ViewModels
|
||||
@model List<PurchaseViewModel>
|
||||
@{
|
||||
ViewData["Title"] = "Purchases";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Покупки</h1>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Надо войти!</h3>
|
||||
return;
|
||||
}
|
||||
<p>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="PurchaseCreate">Создать покупку</a>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="PurchaseUpdate">Изменить покупку</a>
|
||||
<a class="text-decoration-none me-3 text-black h5" asp-action="AddBuildTo">Добавить сборку в покупку</a>
|
||||
<a class="text-decoration-none text-black h5" asp-action="PurchaseDelete">Удалить покупку</a>
|
||||
</p>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Дата
|
||||
</th>
|
||||
<th>
|
||||
Сумма
|
||||
</th>
|
||||
<th>
|
||||
Адрес
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var puchase in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => puchase.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => puchase.DateCreate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => puchase.Sum)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => puchase.DateImplement)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
@ -0,0 +1,26 @@
|
||||
@{
|
||||
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="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-4">Имя:</div><div class="col-8"><input type="text" name="name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Registration"
|
||||
class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
63
ComputerHardwareStore/VendorClient/Views/Home/_Layout.cshtml
Normal file
63
ComputerHardwareStore/VendorClient/Views/Home/_Layout.cshtml
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - AutomobilePlantClientApp</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
<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>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asparea="" asp-controller="Home" asp-action="Index">Компьтерный магазин "Ты ж программист" </a>
|
||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Purchases">Покупки</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Builds">Сборки</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Comments">Комментарии</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ProductsList">Список товаров</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Report">Отчёт</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2024 - Компьютерный магазин
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
25
ComputerHardwareStore/VendorClient/Views/Shared/Error.cshtml
Normal file
25
ComputerHardwareStore/VendorClient/Views/Shared/Error.cshtml
Normal file
@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - ComputerStoreWorkerApp</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="~/ComputerStoreWorkerApp.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">ComputerStoreWorkerApp</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>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2024 - ComputerStoreWorkerApp - <a asp-area="" asp-controller="Home" asp-action="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>
|
@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
@ -0,0 +1,3 @@
|
||||
@using VendorClient
|
||||
@using VendorClient.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
ComputerHardwareStore/VendorClient/appsettings.json
Normal file
9
ComputerHardwareStore/VendorClient/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Loading…
Reference in New Issue
Block a user