<分区>
我的 Controller 上有很多 Action ,如果可能的话,我想只对一个 Action 使用特定的路线。 我正在寻找一种方法来覆盖在 Controller 级别定义的路由。
[Route("api/candidate/attached-file")]
public class AttachedFileController : Controller
{
//overriding controller route
[HttpPost("api/candidate/{id}/attached-file")]
public async Task<IActionResult> AttachFile(string id, [FromBody] AttachedFile file)
{
...
}
//using controller route
[HttpGet("{id}")]
public ActionResult Get(string id) {}
[HttpGet]
public ActionResult GetAll() {}
...
}