Пример #1
0
        public ActionResult Dynamic()
        {
            var model = new DynamicApiList()
            {
                ApiUrl   = "http://localhost/test",
                Exchange = "1"
            };

            return(View(model));
        }
Пример #2
0
        public ActionResult Dynamic(DynamicApiList model)
        {
            var client = new WebClient();

            client.Headers.Add("X-Exchange-ID", model.Exchange);

            var jsonString = client.DownloadString(model.ApiUrl);
            var result     = JsonConvert.DeserializeObject(jsonString);

            model.ApiList = result as JArray;

            if (model.ApiList == null)
            {
                model.ApiObject = result as JObject;
            }

            return(View(model));
        }