This commit is contained in:
abazov73 2023-05-20 02:48:51 +04:00
commit b9f9b339ac
9 changed files with 29 additions and 12 deletions

View File

@ -11,7 +11,7 @@ namespace BankContracts.BindingModels
{ {
public float Amount { get; set; } public float Amount { get; set; }
public DateTime PurchaseDate { get; set; } = DateTime.Now.Date; public DateTime PurchaseDate { get; set; } = DateTime.Now;
public int BankOperatorId { get; set; } public int BankOperatorId { get; set; }

View File

@ -41,7 +41,7 @@ namespace BankDatabaseImplement.Implements
public List<CurrencyPurchaseViewModel> GetFilteredList(CurrencyPurchaseSearchModel model) public List<CurrencyPurchaseViewModel> GetFilteredList(CurrencyPurchaseSearchModel model)
{ {
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.BankOperatorId.HasValue)
{ {
return new(); return new();
} }
@ -53,6 +53,14 @@ namespace BankDatabaseImplement.Implements
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();
} }
else if (model.BankOperatorId.HasValue)
{
using var context = new BankDatabase();
return context.CurrencyPurchases.Include(x => x.BankOperator).Include(x => x.Currency)
.Where(x => x.BankOperatorId == model.BankOperatorId)
.Select(x => x.GetViewModel)
.ToList();
}
else else
{ {
using var context = new BankDatabase(); using var context = new BankDatabase();

View File

@ -57,7 +57,7 @@ namespace BankOperatorApp.Controllers
{ {
throw new Exception("Вы как суда попали? Суда вход только авторизованным"); throw new Exception("Вы как суда попали? Суда вход только авторизованным");
} }
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(lastname) || string.IsNullOrEmpty(firstname) || string.IsNullOrEmpty(middleName)) if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(lastname) || string.IsNullOrEmpty(firstname))
{ {
throw new Exception("Введите логин, пароль и ФИО"); throw new Exception("Введите логин, пароль и ФИО");
} }
@ -210,8 +210,7 @@ namespace BankOperatorApp.Controllers
{ {
throw new Exception("Вы как суда попали? Суда вход только авторизованным"); throw new Exception("Вы как суда попали? Суда вход только авторизованным");
} }
ViewBag.Currency = _currencyLogic.ReadList ViewBag.Currencies = _currencyLogic.ReadList(null);
(new CurrencySearchModel { BankOperatorId = APIClient.BankOperator.Id });
return View(); return View();
} }
[HttpPost] [HttpPost]
@ -230,5 +229,15 @@ namespace BankOperatorApp.Controllers
}); });
Response.Redirect("CurrencyPurchases"); Response.Redirect("CurrencyPurchases");
} }
public IActionResult CurrencyPurchases()
{
if (APIClient.BankOperator == null)
{
return Redirect("~/Home/Enter");
}
return View(_currencyPurchaseLogic.ReadList(new CurrencyPurchaseSearchModel
{ BankOperatorId = APIClient.BankOperator.Id }));
}
} }
} }

View File

@ -8,7 +8,7 @@
<div class="row"> <div class="row">
<div class="col-4">Валюты::</div> <div class="col-4">Валюты::</div>
<div class="col-8"> <div class="col-8">
<select id="currency" name="currency" class="form-control" <select id="currencyId" name="currencyId" class="form-control"
asp-items="@(new SelectList(@ViewBag.Currencies,"Id", "Name"))"></select> asp-items="@(new SelectList(@ViewBag.Currencies,"Id", "Name"))"></select>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
} }
<div class="text-center"> <div class="text-center">
<h1>Кредитная программа№@Model.Id</h1> <h1>Кредитная программа @Model.Id</h1>
</div> </div>
@ -26,7 +26,7 @@
<h3 class="display-4">Валюты:</h3> <h3 class="display-4">Валюты:</h3>
@foreach (var currency in Model.CreditProgramCurrencies) @foreach (var currency in Model.CreditProgramCurrencies)
{ {
<h5 class="display-4"><b>Валюта №@currency.Value.Id</b>, <h5 class="display-4"><b>Валюта № @currency.Value.Id</b>,
@currency.Value.Name</h5> @currency.Value.Name</h5>
} }
</div> </div>

View File

@ -19,7 +19,7 @@
return; return;
} }
<p> <p>
<a asp-action="CreateCurrencyPurchase">Купить валюту</a> <a asp-action="CreateCurrencyPurchase"><button>Купить валюту</button></a>
</p> </p>
<table class="table"> <table class="table">
<thead> <thead>

View File

@ -20,7 +20,7 @@
} }
<p> <p>
<a asp-action="CreateCurrency">Создать валюту</a> <a asp-action="CreateCurrency"><button>Создать валюту</button> </a>
</p> </p>
<table class="table"> <table class="table">
<thead> <thead>

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Имя:</div> <div class="col-4">Имя:</div>
<div class="col-8"><input type="text" name="firstlename" value="@Model.FirstName"/></div> <div class="col-8"><input type="text" name="firstname" value="@Model.FirstName"/></div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Отчество:</div> <div class="col-4">Отчество:</div>

View File

@ -26,7 +26,7 @@
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CreditPrograms">Кредитные программы</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CreditPrograms">Кредитные программы</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CurrencyPurchases">Закупкия</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CurrencyPurchases">Покупки валют</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>