I have an ApiController with a Get action as follows:
public IEnumerable<Note> Get(Guid userId, Guid tagId)
{
var userNotes = _repository.Get(x => x.UserId == userId);
var tagedNotes = _repository.Get(x => x.TagId == tagId);
return userNotes.Union(tagedNotes).Distinct();
}
I want the following actions to be directed to this action:
- HTTP: // {somedomain} / API / notes user id = {} Guid & TagID = {GUID}
- Http: // {somedomain} / API / notes user id = {GUID}?
- HTTP: // {somedomain} / API / notes TagID = {GUID}
In what order should I do this?
UPDATE . Be careful, the api controller should not have another GET method without parameters, or you should use the action with one optional parameter.
source
share