public List <BusJourneyData> GetBusJourneys(Data data, string session) { try { SessionData sessionData = JsonConvert.DeserializeObject <SessionData>(session); BusJourney busJourney = new BusJourney() { DeviceSession = new DeviceSession { DeviceId = sessionData.DeviceId, SessionId = sessionData.SessionId }, Data = new Data { OriginId = data.OriginId, DestinationId = data.DestinationId, DepartureDate = data.DepartureDate } }; Result busJourneyResult = JsonConvert.DeserializeObject <Result>(_restApiService.Post <BusJourney>(Constant.GetBusJourneys, busJourney)); return(JsonConvert.DeserializeObject <List <BusJourneyData> >(busJourneyResult.Data.ToString()).ToList()); } catch (System.Exception) { return(null); } }
public List <BusLocationData> GetBusLocations(string session) { try { SessionData sessionData = JsonConvert.DeserializeObject <SessionData>(session); BusLocation busLocation = new BusLocation() { DeviceSession = new DeviceSession { DeviceId = sessionData.DeviceId, SessionId = sessionData.SessionId } }; Result busLocationResult = JsonConvert.DeserializeObject <Result>(_restApiService.Post <BusLocation>(Constant.GetBusLocations, busLocation)); return(JsonConvert.DeserializeObject <List <BusLocationData> >(busLocationResult.Data.ToString())); } catch (System.Exception) { return(null); } }
public Result GetSession() { string publicIp = new WebClient().DownloadString("https://checkip.amazonaws.com/").Trim(); try { Session session = new Session() { Type = 1, Connection = new Connection { IpAddress = publicIp, Port = "5117" }, Browser = new Browser { Name = browser.Browser, Version = browser.Version } }; return(JsonConvert.DeserializeObject <Result>(_restApiService.Post <Session>(Constant.GetSession, session))); } catch (Exception) { return(null); } }