2024-04-01 20:04:44 +04:00
|
|
|
@{
|
|
|
|
ViewData["Title"] = "Create";
|
|
|
|
}
|
2024-04-02 11:13:02 +04:00
|
|
|
|
2024-04-01 20:04:44 +04:00
|
|
|
<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">
|
2024-04-02 11:13:02 +04:00
|
|
|
<select id="icecream" name="icecream" class="form-control" asp-items="@(new SelectList(@ViewBag.IceCreams,"Id", "IceCreamName"))"></select>
|
2024-04-01 20:04:44 +04:00
|
|
|
</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>
|
2024-04-02 11:13:02 +04:00
|
|
|
$('#icecream').on('change', function () {
|
2024-04-01 20:04:44 +04:00
|
|
|
check();
|
|
|
|
});
|
|
|
|
$('#count').on('change', function () {
|
|
|
|
check();
|
|
|
|
});
|
2024-04-02 11:13:02 +04:00
|
|
|
|
2024-04-01 20:04:44 +04:00
|
|
|
function check() {
|
|
|
|
var count = $('#count').val();
|
2024-04-02 11:13:02 +04:00
|
|
|
var icecream = $('#icecream').val();
|
|
|
|
if (count && icecream) {
|
2024-04-01 20:04:44 +04:00
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "/Home/Calc",
|
2024-04-02 11:13:02 +04:00
|
|
|
data: { count: count, icecream: icecream },
|
2024-04-01 20:04:44 +04:00
|
|
|
success: function (result) {
|
|
|
|
$("#sum").val(result);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</script>
|