With the routeTemplate defined as "api/{controller}/{id}" and having below methods in my controller (ValuesController)
[HttpGet]
public IEnumerable<string> GetX()
{
return new string[] { "xx1", "xx2" };
}
[HttpGet]
public IEnumerable<string> GetY([FromUri]Customer c)
{
return new string[] { "c1", "c2" };
}
public class Customer
{
public bool IsMarried { get; set; }
public string CustName { get; set; }
}
Using the url - "/api/values?IsMarried=false&CustName=aa" results in error - "Multiple actions were found that match the request..." . I am not able to fix above issue without changing the routeTemplate to something like "api/{controller}/{action}/{id}". If anyone knows how to fix above without changing the routeTemplate kindly suggest.
[Route("...")]directive to define a different path for a specific controller only.