예제 #1
0
        private void getDataFromHNAPI(string url, IEntityManager em, string type, string specificType)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            var json = AspectizeHttpClient.Get(url, new Dictionary <string, object>(), new Dictionary <string, string>());

            em.CreateInstanceFromJson(type, json);

            // Must add a specificType to distinguish news and show type (both have type link) to manage repeater filter
            if (specificType == "show")
            {
                foreach (item item in em.GetAllInstances <item>())
                {
                    item.type = "show";
                }
            }

            em.Data.AcceptChanges();
        }