Remade database, clients can now create purchases and components

This commit is contained in:
the
2023-04-08 13:46:24 +04:00
parent b628efed1a
commit 29dd3e6dd9
22 changed files with 343 additions and 1208 deletions

View File

@@ -0,0 +1,57 @@
@using ComputerShopContracts.ViewModels
@model List<ComponentViewModel>
@{
ViewData["Title"] = "Component";
}
<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 asp-action="CreateComponent">Создать комплектующее</a>
</p>
<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.ComponentName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cost)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@@ -0,0 +1,20 @@
@{
ViewData["Title"] = "CreateComponent";
}
<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" id="name" /></div>
</div>
<div class="row">
<div class="col-4">Цена:</div>
<div class="col-8"><input type="text" name="cost" id="cost" /></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

@@ -1,5 +1,5 @@
@{
ViewData["Title"] = "Create";
ViewData["Title"] = "CreatePurchase";
}
<div class="text-center">
<h2 class="display-4">Создание заказа</h2>

View File

@@ -20,7 +20,7 @@
}
<p>
<a asp-action="Create">Создать заказ</a>
<a asp-action="CreatePurchase">Создать заказ</a>
</p>
<table class="table">
<thead>