ASP.NET Core Web API: Routing by method name?

You just need to add the Route to the top of your controller.

Specify the route with api, controller and action:

[Route("api/[controller]/[action]")]
[ApiController]
public class AvailableRoomsController : ControllerBase
{
...
}

Neither could we do action overloads nor prefix action name as Http verb.The way routing works in ASP.NET Core is different than how it did in ASP.NET Web Api.

However, you can simply combine these actions and then branch inside, since all params are optional if you send as querystring

[HttpGet]
public ActionResult<string> Get(int id, string name)
{
  if(name == null){..}
  else{...}
}

Or you need to use attribute routing to specify each api if you send in route data:

[HttpGet("{id}")]       
public ActionResult<string> Get(int id)
{
    return "value";
}


[HttpGet("{id}/{name}")]
public ActionResult<string> Get(int id, string name)
{
    return name;
}

Refer to Attribute Routing,Web Api Core 2 distinguishing GETs