I need to provide in my web api three forms of query: First Get with all records "GetAll", the second GET by the id and a third GET with filtering options, sent by the client eg Name contains the letter " the "and address contains the word" bridge ", I thought of sending by queryString, but it does not hit the correct action, incomplete example of how I thought of getting the Get filtered:
public HttpResponseMessage GetFiltrados() {
string condicao = "";
string[] filtros = Request.RequestUri.Query.Substring(1).Split('&');
foreach (var filtro in filtros) {
condicao += "";
}
if (reg != null) {
return Request.CreateResponse(HttpStatusCode.OK, reg);
} else {
return Request.CreateResponse(HttpStatusCode.NotFound, "Registro não encontrado");
}
}
How can I create these three Get methods? I'm doing the right way with Get with filters to default REST?
Ps .: My POST did in the standard, everything in JSON, but in GET did not know how to solve the filtering.