I have the following routing, which works on invokation /api/demo/info/34
.後端
[Route("api/demo")] public class Demo : Controller { [HttpGet("Info/{x}")] public JsonResult GetInfos(string x) { ... } }
Now, I'd like to pass a query string to select the ID, like so: /api/demo/info?x=34
. How should I rephrase the attribute for that?api
When I tried entering [HttpGet("Info?x={x}")]
, the error message said that the question mark isn't valid there. I want to resolve it through the attributive approach and routing from the default mapping isn't an option.app