I'm struggling to get some Web Api 2.2 routing working correctly. I have a route:
config.Routes.MapHttpRoute(
name: "OrgAdminGetOrgUsers",
routeTemplate: "organisations/{id}/users",
defaults: new { controller = "OrganisationDetails", action = "GetUsersInAnOrganisation" }
);
The problem I'm having is that when I add a query string for making the GET searchable, my routing stops working and I get 404's. I've looked everywhere for examples of using both Uri parameters and a query string, but I can't find anything. It seems like something people would do a lot though? When I remove the query string and the optional parameters from the controller the routing works fine.
Uri:
organisations/3/users?orderby=asc&orderByColumn=surname&start=1&end=15
Controller:
[HttpGet]
public IEnumerable<User> GetUsersInAnOrganisation(int id, string email = "", string firstName = "", string surname = "", string orderByColumn = "", string orderBy = "asc", int start = -1, int end = -1)
Many thanks in advance for any help!
