Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:14:01+00:00 2026-06-06T11:14:01+00:00

So if I had a PersonController and a CompanyController and I call www.example.com/api/person?id=34 it

  • 0

So if I had a PersonController and a CompanyController and I call http://www.example.com/api/person?id=34 it will return both person and company embed into the person xml like so:

<Person xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Example.Models">
    <Name>John Smith</Name>
    <PersonId>34</PersonId>
    <Company>
             <Name>Blah</Name>
    </Company>
</Person>

How would this be done in mvc 4 thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:14:05+00:00Added an answer on June 6, 2026 at 11:14 am

    Just added this to the code to format the xml the way I wanted to this is person

    public string PersonId { get; set; }
    public string Name { get; set; }
    public Company company { get; set; }
    

    this is company:

    public string Name { get; set; }
    

    This is my controller

    cinfo = new Company[] {new Company {Name = CompanyName}};
    info.Add(new Person {PersonId = PersonID, Name = PersonName, company = cinfo[0]});
    

    This is all shortened but these are the changes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Had this: rtable.insert ( pair<string,string>(destination,nhop) ); // route insertion return 0; Changed it to
Had a facebook tab called "Sign Up" as a gateway into an iframe canvas
Had I looked into the Java SE6 documentation sooner on Context and InitialContext, I
Had a major problem recently where my web hosting company messed up and all
Had a page that was working fine. Only change I made was to add
Had a good search here but can't see anything that gets my mind in
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
Had this working; at one stage. The problem is the following text is now
I had a Navigation Controller based application and decided to use tab bars. And
I had been asked to build crystal reports for an application, i used the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.