C # models and collections are transmitted in the front-end, and models and lists <Model> are directly used in the backend,
/******* Splice the Model in the previous section, and directly use the Model class in the background to receive ************/
// Frontend -- 1
Var data = [];
Data. push ({name: 'id', value: "123 "}),
Data. push ({name: 'overage', value: "3% "}),
Data. push ({name: 'sampleqty ', value: "143 "}),
Data. push ({name: 'qty ', value: "123 "}),
// Asynchronous submission (directly passing data arrays without conversion or specifying the variable names received in the background) -- 2
$. Ajax ({
Url: "/order/RfidOrder/ChangeDetailInfoee ",
Data: data,
Success: function (data ){
}
});
// Define receiving in the background -- 3
[Route ("ChangeDetailInfoee")]
[ValidateInput (false)]
Public void ChangeDetailInfoee (ListOption option)
{
}
/***** Directly transmits the List set in the previous section, receives the set in the background, and updates the Name using the index ****
// Frontend -- 1
Var data = [];
Data. push ({name: 'option [0]. id', value: "123 "}),
Data. push ({name: 'option [0]. overage', value: "3% "}),
Data. push ({name: 'option [0]. SampleQty ', value: "143 "}),
Data. push ({name: 'option [0]. Qty ', value: "123 "}),
Data. push ({name: 'option [1]. id', value: "124 "}),
Data. push ({name: 'option [1]. overage', value: "4% "}),
Data. push ({name: 'option [1]. SampleQty ', value: "144 "}),
Data. push ({name: 'option [1]. Qty ', value: "124 "})
// Asynchronous submission (filling the List set by specifying the name of the variable received in the background using the index) -- 2
$. Ajax ({
Url: "/order/RfidOrder/ChangeDetailInfoee ",
Data: data,
Success: function (data ){
}
});
// Define receiving in the background -- 3
[Route ("ChangeDetailInfoee")]
[ValidateInput (false)]
Public void ChangeDetailInfoee (List <ListOption> option)
{
}
/********* ListOption ********/
Public class ListOption
{
Public string Id {get; set ;}
Public string Overage {get; set ;}
Public string SampleQty {get; set ;}
Public string Qty {get; set ;}
}