Web API , Multiple actions were found that match the request Get "" , .
public class House
{
public string Color { get; set; }
public double SquareFeet { get; set; }
public override string ToString()
{
return "Color: " + Color + ", Sq. Ft.:" + SquareFeet;
}
}
public class Car
{
public string Color { get; set; }
public double EngineSize { get; set; }
public override string ToString()
{
return "Color: " + Color + ", cc: " + EngineSize;
}
}
public class ValuesController : ApiController
{
public string Get([FromUri] bool house, [FromUri] House model)
{
return model.ToString();
}
public string Get([FromUri] bool car, [FromUri] Car model)
{
return model.ToString();
}
}
Using the code above, the following URLs give the appropriate output:
~ / api / values house = truth &? = White & squarefeet = 1500
<string>Color: white, Sq. Ft.:1500</string>
~ / api / values car = true &? Color = Black & enginesize = 2500
<string>Color: black, cc: 2500</string>
source
share