c# - Creating Webservice which has child parent concept -


i want create web service below. result list 1 people, want common things it's parent , have many child i.e. detail in it's child level.

  <person>      <id>1</id>      <name>manoj</name>      <age>20</age>      <salary>       <month>1</month>       <money>10000</money>      </salary>      <salary>       <month>2</month>       <money>12000</money>      </salary>      <salary>       <month>3</month>       <money>13000</money>      </salary>     </person> 

but web service return

<person>      <id>1</id>      <name>manoj</name>      <age>20</age>           <month>1</month>      <money>10000</money> </person>  <person>      <id>1</id>      <name>manoj</name>      <age>20</age>           <month>2</month>      <money>12000</money> </person>  <person>      <id>1</id>      <name>manoj</name>      <age>20</age>           <month>2</month>      <money>13000</money> </person> 

my info class

class person  {     int id{get; set;}     string name{get; set;}     int age{get; set;}     int month{get; set;}     int money{get; set;} } 

how can modyfy class rusult.

you try modifying person class include collection of salaeries

public class person  {     public int id{get; set;}     public string name{get; set;}     public int age{get; set;}     public list<salary> salaeries {get; set;} }  public class salary {     int month{get; set;}     int money{get; set;} } 

this suggested in comments


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -