Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Station GetStationData(string city, string station)
- {
- Station stationObject = new Station();
- string data = GetContractDataFromServer(city);
- if (data != "-1")
- {
- JArray stationArray = JArray.Parse(data);
- for (int i = 0; i < stationArray.Count(); i++)
- {
- JObject item = (JObject)stationArray[i];
- if (((string)item["name"]).ToLower().Contains(station.ToLower()))
- {
- stationObject.city = (string)item["contract_name"];
- stationObject.name = (string)item["name"];
- stationObject.address = (string)item["address"];
- stationObject.availableBikes = (int)item["available_bikes"];
- stationObject.latitude = (double)(item["position"]["lat"]);
- stationObject.longitude = (double)(item["position"]["lng"]);
- }
- return stationObject;
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement