Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to pass list child DTO to service #131


User avatar
0
mrthanh created

This is my DTO object

public class ADto : EntityDto<int>, IInputDto{

public List<BDto> ListB{get;set;} }

How to pass data ListB to Service API ?? ListB always is Empty


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Are you using AJAX? If so, you should POST a JSON like that:

    {
      Code: '001',
      CountryId: 1,
      Addresses: [
        {
          Address: '...',
          AddressType: '...',
          ...
        },
        {
          Address: '...',
          AddressType: '...',
          ...
        }
      ]
      ...
    }
    
  • User Avatar
    0
    mrthanh created

    I'm using form :( html form :

    <input type="text" class="textbox-value" name="Identifiers[0].CountryId" > ...

    Thanks

  • User Avatar
    0
    hikalkan created
    Support Team

    And you're calling an MVC action via AJAX? If so, this is not directly related to ASP.NET Boilerplate framework. Because, ASP.NET MVC binds form values to models. So, you can search web for it. I don't use direct form submitting for such scenarios.