PIbd-23-Salin-O.A.-IceCream.../IceCreamShop/IceCreamShopClientApp/Views/Home/Create.cshtml
gg12 darfren d05f1f9695 finally
2024-04-02 11:13:02 +04:00

57 lines
1.3 KiB
Plaintext

@{
ViewData["Title"] = "Create";
}
<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="icecream" name="icecream" class="form-control" asp-items="@(new SelectList(@ViewBag.IceCreams,"Id", "IceCreamName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Количество:</div>
<div class="col-8">
<input type="text" name="count" id="count" />
</div>
</div>
<div class="row">
<div class="col-4">Сумма:</div>
<div class="col-8">
<input type="text" id="sum" name="sum" readonly />
</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>
<script>
$('#icecream').on('change', function () {
check();
});
$('#count').on('change', function () {
check();
});
function check() {
var count = $('#count').val();
var icecream = $('#icecream').val();
if (count && icecream) {
$.ajax({
method: "POST",
url: "/Home/Calc",
data: { count: count, icecream: icecream },
success: function (result) {
$("#sum").val(result);
}
});
};
}
</script>