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 DateTime PurchaseDate { get; set; } = DateTime.Now.Date;
public DateTime PurchaseDate { get; set; } = DateTime.Now;
public int BankOperatorId { get; set; }

View File

@ -41,7 +41,7 @@ namespace BankDatabaseImplement.Implements
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();
}
@ -53,6 +53,14 @@ namespace BankDatabaseImplement.Implements
.Select(x => x.GetViewModel)
.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
{
using var context = new BankDatabase();

View File

@ -57,7 +57,7 @@ namespace BankOperatorApp.Controllers
{
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("Введите логин, пароль и ФИО");
}
@ -210,8 +210,7 @@ namespace BankOperatorApp.Controllers
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
ViewBag.Currency = _currencyLogic.ReadList
(new CurrencySearchModel { BankOperatorId = APIClient.BankOperator.Id });
ViewBag.Currencies = _currencyLogic.ReadList(null);
return View();
}
[HttpPost]
@ -230,5 +229,15 @@ namespace BankOperatorApp.Controllers
});
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="col-4">Валюты::</div>
<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>
</div>
</div>

View File

@ -7,7 +7,7 @@
}
<div class="text-center">
<h1>Кредитная программа№@Model.Id</h1>
<h1>Кредитная программа @Model.Id</h1>
</div>
@ -26,7 +26,7 @@
<h3 class="display-4">Валюты:</h3>
@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>
}
</div>

View File

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

View File

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

View File

@ -23,7 +23,7 @@
</div>
<div class="row">
<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 class="row">
<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>
</li>
<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 class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>