Example #1
0
        public async Task <ActionResult> Index()
        {
            //Initialize
            IRest repos = DataFactory.RestRepository();


            //Setting target Url
            string     targetURI = ConfigurationManager.AppSettings["RestInfoURL"].ToString();
            HttpClient client    = new HttpClient();

            client.MaxResponseContentBufferSize = Int32.MaxValue;
            //Get Parking Json Format (not completed json)
            var response = await client.GetStringAsync(targetURI);

            JObject       o           = (JObject)JsonConvert.DeserializeObject(response);
            StringBuilder sb          = new StringBuilder(o.SelectToken("result").SelectToken("records").ToString());
            string        uBikeString = sb.Replace("#", string.Empty).Replace("@", string.Empty).ToString();
            //Deserialize
            var collection = JsonConvert.DeserializeObject <IEnumerable <RestDeserialize> >(uBikeString);

            //Add Alert Info
            repos.AddRestInfo(collection);

            return(View());
        }