javascript - WebApi 2: What parameter type to expect in ApiController action for Associative Arrays -
i'm receiving request this:
myserver.com/api/userapi?current=1&rowcount=10&sort[username]=asc&searchphrase=john&id=265447
i implemented api controller action this:
public class userapicontroller : apicontroller { public ienumerable<userviewmodel> get(int current, int rowcount, dictionary<string,string> sort, string searchphrase, int id) { // users based on parameters... } }
i tried declaring list<customtype>
customtype
has 2 string properties, suggest here, no success.
when i'm debugging, parameters passed properly, except sort
looks associative array. tried declaring object, keeps coming null. changing url request not option, since i'm not requester , can't ask them change request format.
even though can't change url format request, can determine if it's coming or post requests. options tried both methods (of course renaming apicontroller action method name post).
what type should expect, or how solve this?
Comments
Post a Comment