diff --git a/Bank/BankContracts/BindingModels/CurrencyPurchaseBindingModel.cs b/Bank/BankContracts/BindingModels/CurrencyPurchaseBindingModel.cs index d0b8727..ca5d54b 100644 --- a/Bank/BankContracts/BindingModels/CurrencyPurchaseBindingModel.cs +++ b/Bank/BankContracts/BindingModels/CurrencyPurchaseBindingModel.cs @@ -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; } diff --git a/Bank/BankDatabaseImplement/Implements/CurrencyPurchaseStorage.cs b/Bank/BankDatabaseImplement/Implements/CurrencyPurchaseStorage.cs index 0e50b36..53d5773 100644 --- a/Bank/BankDatabaseImplement/Implements/CurrencyPurchaseStorage.cs +++ b/Bank/BankDatabaseImplement/Implements/CurrencyPurchaseStorage.cs @@ -41,7 +41,7 @@ namespace BankDatabaseImplement.Implements public List 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(); diff --git a/Bank/BankOperatorApp/Controllers/HomeController.cs b/Bank/BankOperatorApp/Controllers/HomeController.cs index 9973ba6..7bc8f06 100644 --- a/Bank/BankOperatorApp/Controllers/HomeController.cs +++ b/Bank/BankOperatorApp/Controllers/HomeController.cs @@ -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 })); + } } } \ No newline at end of file diff --git a/Bank/BankOperatorApp/Views/Home/CreateCurrencyPurchase.cshtml b/Bank/BankOperatorApp/Views/Home/CreateCurrencyPurchase.cshtml index 17a6641..c0c31e5 100644 --- a/Bank/BankOperatorApp/Views/Home/CreateCurrencyPurchase.cshtml +++ b/Bank/BankOperatorApp/Views/Home/CreateCurrencyPurchase.cshtml @@ -8,7 +8,7 @@
Валюты::
-
diff --git a/Bank/BankOperatorApp/Views/Home/CreditProgram.cshtml b/Bank/BankOperatorApp/Views/Home/CreditProgram.cshtml index 02be98c..c613177 100644 --- a/Bank/BankOperatorApp/Views/Home/CreditProgram.cshtml +++ b/Bank/BankOperatorApp/Views/Home/CreditProgram.cshtml @@ -7,7 +7,7 @@ }
-

Кредитная программа№@Model.Id

+

Кредитная программа № @Model.Id

@@ -26,7 +26,7 @@

Валюты:

@foreach (var currency in Model.CreditProgramCurrencies) { -
Валюта №@currency.Value.Id, +
Валюта № @currency.Value.Id, @currency.Value.Name
} \ No newline at end of file diff --git a/Bank/BankOperatorApp/Views/Home/CurrencyPurchases.cshtml b/Bank/BankOperatorApp/Views/Home/CurrencyPurchases.cshtml index 08c0cdd..ddf22e5 100644 --- a/Bank/BankOperatorApp/Views/Home/CurrencyPurchases.cshtml +++ b/Bank/BankOperatorApp/Views/Home/CurrencyPurchases.cshtml @@ -19,7 +19,7 @@ return; }

- Купить валюту +

diff --git a/Bank/BankOperatorApp/Views/Home/Index.cshtml b/Bank/BankOperatorApp/Views/Home/Index.cshtml index 6c2adb4..77a4ac4 100644 --- a/Bank/BankOperatorApp/Views/Home/Index.cshtml +++ b/Bank/BankOperatorApp/Views/Home/Index.cshtml @@ -20,7 +20,7 @@ }

- Создать валюту +

diff --git a/Bank/BankOperatorApp/Views/Home/Privacy.cshtml b/Bank/BankOperatorApp/Views/Home/Privacy.cshtml index 336c853..5351e02 100644 --- a/Bank/BankOperatorApp/Views/Home/Privacy.cshtml +++ b/Bank/BankOperatorApp/Views/Home/Privacy.cshtml @@ -23,7 +23,7 @@
Имя:
-
+
Отчество:
diff --git a/Bank/BankOperatorApp/Views/Shared/_Layout.cshtml b/Bank/BankOperatorApp/Views/Shared/_Layout.cshtml index 5bcf537..6212d5c 100644 --- a/Bank/BankOperatorApp/Views/Shared/_Layout.cshtml +++ b/Bank/BankOperatorApp/Views/Shared/_Layout.cshtml @@ -26,7 +26,7 @@ Кредитные программы