Esempio n. 1
0
        // GET: AlertCust
        public async Task <ActionResult> Index()
        {
            //Initialize
            IAlert repos = DataFactory.AlertRepository();


            //Setting target Url
            string     targetURI = ConfigurationManager.AppSettings["AlertInfoURL"].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("entry").ToString());
            string        alertString = sb.Replace("#", string.Empty).Replace("@", string.Empty).ToString();
            //Deserialize
            var collection = JsonConvert.DeserializeObject <IEnumerable <AlertDeserialize> >(alertString);

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

            return(View());
        }