Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

API2 MVC Controller PUT with several database records in a list: How to call?

$
0
0

Hi all,

I have an API2 controller action I would like to pass several records to.

Here is the API2 Controller I would like to call. I want to call the API2 controller once and avoid several calls updating record-by-record. 

[ResponseType(typeof(void))]

[Route("api/MEASURE_CAPTURE1/PutByTR_ID")]

publicIHttpActionResult PutMEASURE_CAPTUREs(List<MEASURE_CAPTURE1>serialisedMeasureList )

        {

// loop through the list and update remote database here.

}

I would like to know please what changes should I make to webapi2 controller action and to MVC controller action?

Should I pass in a  serialized object? For example, var serialisedMeasureList = JsonConvert.SerializeObject(RecsForTR_ID,Formatting.Indented);

Many thanks for viewing and posting answers.

Stew


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>