I have a function like below
public CaseController{
[HttpGet(GetAll/{parameter1:maxlength(50)?}/{parameter2:maxlength(50)?}/{parameter3:maxlength(50)?})
public IEnumerable<CaseDomainModel> GetAll(string parameter1 = null,string parameter2 = null,string parameter3 = null)
{
// Code Goes here
}
}
The api call generated goes like this
api/case/GetAll/value1 or api/case/GetAll//value2 or or api/case/GetAll///value3
which ever value is passed from the front end to this particular api method the value is getting passed to parameter1.
I searched SO and tried to follow Optional Parameters in Web Api Attribute Routing but unable to find a resolution.
My project is Angular 2 front end + webapi2 with asp.net core as a service layer.
Could you please let me know how to make webapi2 understand my optional parameters