C # Model and set are uploaded in the previous section, and Model and List & lt; Model & gt; are directly used in the background for receiving,

Source: Internet
Author: User

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 ;}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.