Search code examples
ajaxnancy

In Nancyfx how to pass array of Ids


I want to see if there is a way to capture an array of Ids on the backend.

I have this post method.

        $http({
            method: 'POST',
            url: "posting",
            headers: {'Content-Type': 'application/json'},
            data: myIds // ["1","2" ... etc ]
        })

and on the back end question is how do I bind the ids to some variable?

        Post["posting"] = p =>
        {
            var data = this.Bind();// here is the problem ????
            var OK = someMethod(data);
            return OK;
        };

I could make it work if I add another model, but do we always need a model?


Solution

  • This may help someone else.

    this is what i did and it worked:

                string[] s = {};
                s = this.Bind();
    

    now my s contains all the ids.