42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
|
@using Newtonsoft.Json;
|
||
|
@{
|
||
|
ViewData["Title"] = "UpdateTableware";
|
||
|
}
|
||
|
<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="Id" name="Id" class="form-control" onchange="populateFields()" asp-items="@(new SelectList(@ViewBag.Tablewares, "Id", "TablewareName"))"></select></div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col-4">Название прибора:</div>
|
||
|
<div class="col-8">
|
||
|
<input type="text" name="TablewareName" id="TablewareName" />
|
||
|
</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>
|
||
|
const tablewars = [];
|
||
|
|
||
|
function populateFields() {
|
||
|
ViewBag.Tablewares.forEach(value => {
|
||
|
tablewars.push(value);
|
||
|
});
|
||
|
var selectedTablewareId = document.getElementById("Id").value;
|
||
|
var selectedTableware = tablewares.find(function (tableware) {
|
||
|
return tableware.Id === selectedTablewareId;
|
||
|
});
|
||
|
//console.log(selectedCook.FIO);
|
||
|
if (selectedTableware) {
|
||
|
document.getElementsByName("TablewareName")[0].value = selectedTableware.TablewareName;
|
||
|
document.getElementsByName("TablewareCount")[0].value = selectedTableware.TablewareCount;
|
||
|
}
|
||
|
console.log(document.getElementsByName("TablewareName")[0].value);
|
||
|
}
|
||
|
</script>*@
|