.net - Web API Post get related data from json.stringify -


i have html page button on it. here functions important:

function updateclick() {     sop10100 = new object();     sop10100.custnmbr = "5000";     sop10100.shipmthd = "fedex";     sop10100.sop10200 = [{ itemnmbr: "120604", quantity: 3, unitprice: .98, uofm: "roll" }, { itemnmbr: "120604", quantity: 1, unitprice: 4.98, uofm: "6 roll" }, { itemnmbr: "120604", quantity: 2, unitprice: 10.98, uofm: "12 roll" }]      salesordercreate(sop10100); }  function salesordercreate(sop10100) {    $.ajax({         url: '/api/sop10100',         type: 'post',         contenttype: "application/json;charset=utf-8",         data: json.stringify(sop10100),         success: function (data) {             salesordersuccess(data);         },         error: function (request, message, error) {             handleexception(request, message, error);         }     }); } 

here controller handles click:

' post: api/sop10100 <responsetype(gettype(sop10100))> function postsop10100(byval sop10100 sop10100) ihttpactionresult     if not modelstate.isvalid         return badrequest(modelstate)     end if      try 

'create document header dim otasophdrivcinsert new serialization.tasophdrivcinsert

        'populate header         otasophdrivcinsert             .docid = "eq sale ord"             .bachnumb = "weborder"             .locncode = "warehouse"             .docdate = datestring 'today             .custnmbr = sop10100.custnmbr             .shipmthd = sop10100.shipmthd             .refrence = sop10100.refrence     end 

here i'm stuck. need loop through sop10200 (which order lines) , each 1 this:

dim otasoplineivcinsert new serialization.tasoplineivcinsert_itemstasoplineivcinsert  otasoplineivcinsert     .sopnumbe = strsopnumber     .soptype = 2     .docdate = datestring     .itemnmbr = sop10100.sop10200.itemnmbr end 

but can't seem able itemnmbr in code. can see when debugging, know there.

if wasn't coming api linq query query ,

for each iv00101 in query 

any on appreciated. know code in vb, problem applies c#.

you need access collection property sop10200 access it's items:

 each iv00101 in sop10100.sop10200        'do work   next 

Comments