Продолжил делать формы

This commit is contained in:
Artyom_Yashin 2024-04-30 18:42:54 +04:00
parent dac290dc21
commit abf550a6bd
9 changed files with 291 additions and 6 deletions

View File

@ -103,7 +103,7 @@ namespace BankBusinessLogic.BusinessLogic
private bool ChangeStatus(RequestBindingModel model, RequestStatus status)
{
//поменять
//todo поменять
model.Status = status;
_requestStorage.Update(model);
return true;

View File

@ -6,6 +6,11 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Content Remove="Views\Home\CardCreate.cshtml" />
<Content Remove="Views\Home\Operation.cshtml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
@ -16,4 +21,20 @@
<ProjectReference Include="..\BankDatabaseImplement\BankDatabaseImplement.csproj" />
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="Views\Home\CardCreate.cshtml" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="Views\Home\CardCreate.cshtml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Views\Home\Operation.cshtml" />
</ItemGroup>
<ItemGroup>
<None Include="Views\Home\CardCreate.cshtml" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,32 @@
@{
ViewData["Title"] = "CardCreate";
}
<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="number" id="number" />
</div>
</div>
<div class="row">
<div class="col-4">CVV:</div>
<div class="col-8">
<input type="text" name="cvv" id="cvv" />
</div>
</div>
<div class="row">
<div class="col-4">PIN:</div>
<div class="col-8">
<input type="text" name="pin" id="pin" />
</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,20 @@
//todo выводить список только для выбранного клиента
@{
ViewData["Title"] = "CardDelete";
}
<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="card" name="card" class="form-control" asp-items="@(new SelectList(@ViewBag.Cards, "Id", "Number"))"></select>
</div>
</div>
<div class="row">
<div class="col-4"></div>
<div class="col-8"><input type="submit" value="Удалить" class="btn btn-danger" /></div>
</div>
</form>

View File

@ -0,0 +1,78 @@
@using BankContracts.ViewModels;
//todo выводить список только для выбранного клиента
@{
ViewData["Title"] = "CardUpdate";
}
<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="card" name="card" class="form-control" asp-items="@(new SelectList(@ViewBag.Cards, "Id", "Number"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Номер:</div>
<div class="col-8"><input type="text" name="number" id="number" class="form-control" /></div>
</div>
<div class="row">
<div class="col-4">CVV:</div>
<div class="col-8"><input type="text" id="cvv" name="cvv" class="form-control" /></div>
</div>
<div class="row">
<div class="col-4">PIN:</div>
<div class="col-8"><input type="text" id="pin" name="pin" class="form-control" /></div>
</div>
<div class="row">
<div class="col-4">Срок действия:</div>
<div class="col-8"><input type="datetime-local" id="expirationdate" name="expirationdate" class="form-control" required /></div>
</div>
<table class="table">
<thead>
<tr>
<th>
Компьютеры
</th>
<th>
Количество
</th>
</tr>
</thead>
<tbody id="table-elements">
</tbody>
</table>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>
@section Scripts
{
<script>
function check() {
var card = $('#card').val();
if (card) {
$.ajax({
method: "GET",
url: "/Home/GetCard",
data: { cardId: card },
success: function (result) {
$('#number').val(result.item1.number);
$('#cvv').val(result.item1.cvv);
$('#pin').val(result.item1.pin);
$('#expirationdate').val(result.item1.expirationDate);
}
});
};
}
check();
$('#card').on('change', function () {
check();
});
</script>
}

View File

@ -14,7 +14,10 @@
return;
}
<p>
<a asp-action="Create">Создать карту</a>
<a asp-action="CardCreate">Создать карту</a>
<a asp-action="CardUpdate">Обновить карту</a>
//todo мб убрать
<a asp-action="CardDelete">Удалить карту</a>
</p>
<table class="table">
<thead>

View File

@ -0,0 +1,68 @@
@using BankContracts.ViewModels
@model List<OperationViewModel>
@{
ViewData["Title"] = "Operation";
}
<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="OperationCreate">Создать операцию</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Сумма
</th>
<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.Sum)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.OperationTime)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.SenderCardNumber)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.RecipientCardNumber)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -0,0 +1,32 @@
@{
ViewData["Title"] = "OperationCreate";
}
<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="number" id="number" />
</div>
</div>
<div class="row">
<div class="col-4">CVV:</div>
<div class="col-8">
<input type="text" name="cvv" id="cvv" />
</div>
</div>
<div class="row">
<div class="col-4">Отправитель:</div>
<div class="col-8">
<select id="card" name="card" class="form-control" asp-items="@(new SelectList(@ViewBag.Cards, "Id", "Number"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Получатель:</div>
<div class="col-8">
<select id="card" name="card" class="form-control" asp-items="@(new SelectList(@ViewBag.Cards, "Id", "Number"))"></select>
</div>
</div>
</form>

View File

@ -1,6 +1,37 @@
@{
@using BankContracts.ViewModels
@model ClientViewModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
<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"
value="@Model.Email" />
</div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8">
<input type="password" name="password"
value="@Model.Password" />
</div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8">
<input type="text" name="fio"
value="@Model.Fio" />
</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>