Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
668fb68546
@ -145,32 +145,46 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
}
|
||||
|
||||
//открытие счёта. Получаем и передаём список изделий во вьюху?
|
||||
/*[HttpGet]
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.Accountes = APICashier.GetRequest<List<AccountViewModel>>("/api/Cashier/GetAllAccounts");
|
||||
ViewBag.Clients = APICashier.GetRequest<List<ClientViewModel>>("/api/Client/GetAllClients");
|
||||
|
||||
return View();
|
||||
}*/
|
||||
}
|
||||
|
||||
//создание заказа Post-запросом
|
||||
[HttpPost]
|
||||
public void Create(int account, int count)
|
||||
public void Create(int clientId, string accountNumber, string password, int balance)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
//throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (count <= 0)
|
||||
if (clientId <= 0)
|
||||
{
|
||||
throw new Exception("Количество и сумма должны быть больше 0");
|
||||
throw new Exception("Некоректный ID клиента!");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("api/main/createaccount", new AccountBindingModel
|
||||
if (string.IsNullOrEmpty(accountNumber) && accountNumber.Length < 8)
|
||||
{
|
||||
ClientId = APICashier.Cashier.Id
|
||||
//TODO
|
||||
throw new Exception("Некорректный номер счёта");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(password) && password.Length < 6)
|
||||
{
|
||||
throw new Exception("Некорректный пароль");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("/api/Account/Register", new AccountBindingModel
|
||||
{
|
||||
CashierId = APICashier.Cashier.Id,
|
||||
ClientId = clientId,
|
||||
AccountNumber = accountNumber,
|
||||
PasswordAccount = password,
|
||||
Balance = balance,
|
||||
DateOpen = DateTime.Now
|
||||
});
|
||||
|
||||
Response.Redirect("Index");
|
||||
|
@ -9,13 +9,25 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Клиент:</div>
|
||||
<div class="col-8">
|
||||
<select id="client" name="client" class="form-control"></select>
|
||||
<select id="client" name="clientId" class="form-control" asp-items="@(new SelectList( @ViewBag.Clients, "Id", "Surname"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Дата открытия счёта:</div>
|
||||
<div class="col-4">Номер счёта:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="dateOpen" name="dateOpen" readonly />
|
||||
<input type="text" id="accountNumber" name="accountNumber" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="password" name="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Баланс:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="balance" name="balance" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -25,14 +37,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
$('#client').on('change', function () {
|
||||
check();
|
||||
});
|
||||
|
||||
function check() {
|
||||
$("#dateOpen").val(today);
|
||||
}
|
||||
</script>
|
@ -15,8 +15,8 @@ namespace BankYouBankruptDatabaseImplement
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=SHADOWIK\SHADOWIK;Initial Catalog=BankYouBankrupt;Integrated Security=True;TrustServerCertificate=True");
|
||||
//optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-CFLH20EE\SQLEXPRESS;Initial Catalog=BankYouBankrupt;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
//optionsBuilder.UseSqlServer(@"Data Source=SHADOWIK\SHADOWIK;Initial Catalog=BankYouBankrupt;Integrated Security=True;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=LAPTOP-CFLH20EE\SQLEXPRESS;Initial Catalog=BankYouBankrupt;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user