SamplesController:
Код: Выделить всё
public ActionResult Create()
{
SampleVM samplevm = new SampleVM();
return View();
}
Код: Выделить всё
$(function () {
var Samples = [];
$('#SpecificationName').change(function () {
var specificationName = $(this).val();
var lotId = $('#LotId').val();
var url = 'https://localhost:44372/Samples/FilterAttributes';
var queryString = url + '?specificationName=' + specificationName + '&lotId=' = lotId;
$('#filter-table').load(queryString);
});
});
Код: Выделить всё
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SaveSamples(List samples)
{
if (ModelState.IsValid)
{
Sample sample = new Sample();
db.Samples.Add(sample);
return RedirectToAction("Create");
}
return View(samples);
}
Полезная нагрузка POST:
Код: Выделить всё
__RequestVerificationToken: some token
item.SpecificationAttributeId: 37627
item.AttributeId: 994
item.Value: 1
item.SpecificationAttributeId: 37628
item.AttributeId: 993
item.Value: 1
Подробнее здесь: https://stackoverflow.com/questions/791 ... controller
Мобильная версия