0

I have two controllers, routes of which nested. Both use REST. Problem is, I cannot call child route, as parent actions blocking them

[RoutePrefix("api/foo")]
public class FooController : ApiController
{
    [Route("{id}")]
    public Workflow Get(int id)
    {
        ////
    }
}

[RoutePrefix("api/foo/types")]
public class FooTypesController : ApiController
{
    public Workflow Get()
    {
       ////
    }
}

If call api/foo/types, I am getting

The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'Get(Int32)'

Mansur Anorboev
  • 580
  • 1
  • 7
  • 17
  • 3
    Does this answer your question? [Multiple Controller Types with same Route prefix ASP.NET Web Api](https://stackoverflow.com/questions/23094584/multiple-controller-types-with-same-route-prefix-asp-net-web-api) – Ashiquzzaman Feb 27 '20 at 05:19
  • make the id optional 'int id= 0' or 'int? id = null' – Vince Feb 27 '20 at 09:03

0 Answers0