I have a controller with a GET method as follows:
[HttpGet]
[Route("customer/{custId}")]
public ActionResult GetCustomers([FromRoute]string custId, string prodId= "", string tagNo = "")
{
}
I want this to work like:
/api/customer/123 -- where it returns the data for customer id =123
/api/customer -- where it returns all customers
/api/customer?prodId=xyz --where it returns data for productId=xyz
/api/customer?tagNo=xyz123
But currently, it only works in the following way:
/api/customer/123?prodId=xyz
Is there a way I could do that in just one method