0

Based on the following question: passing-multiple-json-objects-as-data-using-jquerys-ajax

My situation is similar, however different, and I was wondering if the solution applies:

My WEB.API code section is as follows:

[Route("api/admin/SiteSettings/UpdateCompanyContactInformation")]
[HttpPut]
[ResponseType(typeof(SiteSettings.CompanyContactInformation))]
public IHttpActionResult UpdateCompanyContactInformation(
    SiteSettings.CompanyContactInformation _oCompanyContactInformation,
    SiteSettings.SiteDetails _oSiteDetails)
{
    SiteSettings _oSiteSettings = new SiteSettings();
    return Ok(_oSiteSettings.CompanyContactInformation_Update(_oCompanyContactInformation, _oSiteDetails));
}

So back to my main question do I do a multi-level JSON data object as:

_data={_oCompanyContactInformation: { ... }, _oSiteDetails: {...}}

??

Community
  • 1
  • 1
John Schultz
  • 672
  • 1
  • 10
  • 29
  • Yes, the answer is the same. – Gregoire D. Mar 17 '15 at 07:47
  • getting the following error: – John Schultz Mar 17 '15 at 08:15
  • "Message":"An error has occurred.","ExceptionMessage":"Can't bind multiple parameters ('_oCompanyContactInformation' and '_oSiteDetails') to the request's content." – John Schultz Mar 17 '15 at 08:16
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders Mar 17 '15 at 18:00
  • If you're using the web api controller, the fact is that those controllers only allow one parameter. If you want to keep using those controller, you'll have to create a new class encapsulating the others. Else you can use a normal controller, then you'll have the ability to have multiple parameters. – Gregoire D. Mar 18 '15 at 09:25
  • Thank you @GregoireD. That makes perfect sense. – John Schultz Mar 18 '15 at 13:40

0 Answers0