CloseCrediting.cshtml
This commit is contained in:
parent
841d1e435a
commit
0e96f959d2
@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankYouBankruptRestAPI", "B
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankYouBankruptCashierApp", "BankYouBankruptCashierApp\BankYouBankruptCashierApp.csproj", "{3530E2D9-CC6C-4F88-B9AA-90F5E6BBDE01}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankYouBankruptCashierApp", "BankYouBankruptCashierApp\BankYouBankruptCashierApp.csproj", "{3530E2D9-CC6C-4F88-B9AA-90F5E6BBDE01}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BankYouBankruptClientApp", "BankYouBankruptClientApp\BankYouBankruptClientApp.csproj", "{8AD664D9-240B-41CD-9AB6-B56C64AC4291}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BankYouBankruptClientApp", "BankYouBankruptClientApp\BankYouBankruptClientApp.csproj", "{8AD664D9-240B-41CD-9AB6-B56C64AC4291}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -9,9 +9,17 @@ namespace BankYouBankruptCashierApp
|
|||||||
{
|
{
|
||||||
private static readonly HttpClient _client = new();
|
private static readonly HttpClient _client = new();
|
||||||
|
|
||||||
//поле, хранящее кассира, которого необходимо авторизовать
|
//Вью-модели, необходимые для дальнейшего генерирования запросов к апишке
|
||||||
public static CashierViewModel? Cashier { get; set; } = null;
|
public static CashierViewModel? Cashier { get; set; } = null;
|
||||||
|
|
||||||
|
public static CreditingViewModel? Crediting { get; set; } = null;
|
||||||
|
|
||||||
|
public static DebitingViewModel? Debiting { get; set; } = null;
|
||||||
|
|
||||||
|
public static AccountViewModel? Account { get; set; } = null;
|
||||||
|
|
||||||
|
public static CardViewModel? Card { get; set; } = null;
|
||||||
|
|
||||||
public static void Connect(IConfiguration configuration)
|
public static void Connect(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||||
|
@ -258,5 +258,44 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
|
|
||||||
return View(APICashier.GetRequest<List<DebitingViewModel>>($"/api/Account/FindOpenDebiting"));
|
return View(APICashier.GetRequest<List<DebitingViewModel>>($"/api/Account/FindOpenDebiting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//открытие формы отчёта. Получаем и передаём список изделий во вьюху?
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult CloseCrediting()
|
||||||
|
{
|
||||||
|
ViewBag.Creditings = APICashier.GetRequest<List<CreditingViewModel>>("/api/Account/FindOpenCrediting");
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
//создание отчёта Post-запросом
|
||||||
|
[HttpPost]
|
||||||
|
public void CloseCrediting(int creditingId)
|
||||||
|
{
|
||||||
|
if (APICashier.Cashier == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(creditingId < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Некорректный номер заявки на зачисление");
|
||||||
|
}
|
||||||
|
|
||||||
|
//получаем необходимые данные для запроса
|
||||||
|
APICashier.Crediting = APICashier.GetRequest<CreditingViewModel>($"/api/Account/FindCrediting?id={creditingId}");
|
||||||
|
|
||||||
|
APICashier.Card = APICashier.GetRequest<CardViewModel>($"/api/Card/FindCard?id={APICashier.Crediting.CardId}");
|
||||||
|
|
||||||
|
APICashier.PostRequest("/api/Account/CloseCrediting", new MoneyTransferBindingModel
|
||||||
|
{
|
||||||
|
CashierId = APICashier.Cashier.Id,
|
||||||
|
CreditingId = creditingId,
|
||||||
|
Sum = APICashier.Crediting.Sum,
|
||||||
|
AccountPayeeId = APICashier.Card.AccountId
|
||||||
|
});
|
||||||
|
|
||||||
|
Response.Redirect("Crediting");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Одобрение зачислений";
|
||||||
|
}
|
||||||
|
|
||||||
|
<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="creditig" name="creditingId" class="form-control" asp-items="@(new SelectList( @ViewBag.Creditings, "Id", "Id"))"></select>
|
||||||
|
</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>
|
@ -0,0 +1,5 @@
|
|||||||
|
@*
|
||||||
|
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
|
*@
|
||||||
|
@{
|
||||||
|
}
|
@ -18,7 +18,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create">Одобрение заявки</a>
|
<a asp-action="CloseCrediting">Одобрение заявки</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -222,5 +222,22 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public CreditingViewModel FindCrediting(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _creditingLogic.ReadElement(new CreditingSearchModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка входа в систему");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,5 +82,22 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
Response.StatusCode = (int)HttpStatusCode.NotAcceptable;
|
Response.StatusCode = (int)HttpStatusCode.NotAcceptable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public CardViewModel FindCard(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _cardLogic.ReadElement(new CardSearchModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка входа в систему");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user