I have strict API routing requirements. This must be a Get request and the routing cannot be changed. The user can search for people by name, but he can also search for them by part of the name:
api/People?name=Tom - "Tom" can be in any part of the name, ignore case
api/People?name:contains=Tom - "Tom" must be at the beginning of the name, ignore case
api/People?name:exact=Tom - "Tom" must be case sensitive
How it should be implemented in the controller?
There is an option with 3 parameters, can this be improved?
public async Task<IActionResult> GetByName(
[FromQuery(Name = "name")] string name,
[FromQuery(Name = "name:contains")] string beginName,
[FromQuery(Name = "name:exact")] string exactName)