How to pass array of objects and each objects contains two objects JavaScript to controller in c#

Viewed 29

(sample request param would be)

request object would have ( array[0] : {objects1,objects2} array[1] : {objects1,objects2})

request = {
            "RequestRowIds": row["RowId"], // objects1
            "SelectedRequest": request     // objects2
        };

API call :

return common.utils.httpPost("/Test/Create?" + request ).then(function (response) 
  {
common.toastr.success('Saved ' + Create.name + ' successfully!');

  });

Value has been assigned at "request" and while passing the values to the controller. Its getting skipped. (error is "request" property)

class property declaration :

    public class RequestItems
    {
        public dynamic RequestRowIds { get; set; }
        public dynamic SelectedRequest { get; set; }
    }

and the controller would be :

    public async Task<Result> TestCreate(List<RequestItems> request )
    {
          // serviceLayer(request)
    }

The call doesn't comes to controller part from the frontend, its getting skipped frontend itself.

I have tried with

public class request
    {
    public IEnumerable<object> request{ get; set; }
    public dynamic request{ get; set; }
    public List<dynamic> request{ get; set; }
    }

Please help to resolve this issue.

0 Answers
Related