Thursday, December 13, 2018

You may post a "nested" object to an MVC endpoint to hydrate both simple variables and POCOs therein.

Assuming an ASP.NET MVC endpoint like so:

[HttpPost]
public ActionResult SaveEditedAddress(int foo, Bar baz, string qux)
{

 
 

Hand it a JSON object like so:

var postPacket = {
   foo: 13,
   baz: {
      yin: 42,
      yang: 69
   },
   qux: "eighty-six"
};

No comments:

Post a Comment