How can I pass in multiple parameters to Get methods in an MVC 6 controller. For example I want to be able to have something like the following.
[Route("api/[controller]")]
public class PersonController : Controller
{
public string Get(int id)
{
}
public string Get(string firstName, string lastName)
{
}
public string Get(string firstName, string lastName, string address)
{
}
}
So I can query like.
api/person?id=1
api/person?firstName=john&lastName=doe
api/person?firstName=john&lastName=doe&address=streetA
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…