My app asks customers about features of the car they want to rent then it goes to my Database and do some search and come back with the findings and number of available cars based on the loop.
I'm just wondering which method is right to implement in my iOS app. In the API I created there is an index function to return all cars in my database in JSON style.
The question is: Should I create a function in my API that takes the parameters from app and loop in my database and return the result to customers?
or
Should the app get the index as JSON and do the loop with swift?
the JSON from the index will look something like this
[
{
"id": 1,
"created_at": "2016-11-13 12:06:02",
"updated_at": "2016-11-13 12:06:02",
"name": “R”,
"age": “12y”,
“plate#”: “43YTR”,
"status": "request",
"appearance": "ok",
“made”: “USA”
},
{
"id": 1,
"created_at": "2016-11-13 12:06:02",
"updated_at": "2016-11-13 12:06:02",
"name": “H_Y”,
"age": “4yt",
“plate#”: “11112JK”,
"status": “coming”,
"appearance": "ok",
“made”: “Korea”
},
]