Web Api already defines a member called 'Get' with the same parameter types
asp.net, asp.net-mvc, asp.net-web-api, c#
Solution
I think you have to name your get functions:
public class UsersController : ApiController
{
// GET api/companies/GetByUser/{company_id}/{user_id}
public object GetByUser(int company_id, int user_id)
{
...
}
// GET api/companies/GetByPlanet/{company_id}/{plant_id}
public IEnumerable<object> GetByPlanet(int company_id, int plant_id)
{
...
}
}
Problem
``` public class UsersController : ApiController { // GET api/companies/{company_id}/users/{user_id} public object Get(int company_id, int user_id) { ... } // GET api/companies/{company_id}/plants/{plant_id}/users public IEnumerable<object> Get(int company_id, int plant_id) { ... } } ``` The first method should return a single user part of a company The second method should return a list users part of a company and a plant ERROR Type '...' already defines a member called 'Get' with the same parameter types Is it possible to avoid Web Api to interpret the second Get as a redefinition? if looked at http://aspnetwebstack.codeplex.com/wikipage?title=Attribute%20routing%20in%20Web%20API where in scenario 3 uses [HttpGet("...")]notations ``` public class MoviesController : ApiController { [HttpGet("actors/{actorId}/movies")] public Movie Get(int actorId) { } [HttpGet("directors/{directorId}/movies")] public Movie Get(int directorId) { } } ``` but in my case [HttpGet(...)] ERROR 'System.Web.Http.HttpGetAttribute' does not contain a constructor that takes 1 arguments