コード例 #1
0
        public DataTable SetTableFolder(SBRecoverFolder listFolders)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("ID");
            dt.Columns.Add("CARPETA");
            dt.Columns.Add("SUBCRISTORES");


            foreach (var item in listFolders.folders)
            {
                dt.Rows.Add(item.id, item.name, item.uniqueSubscribers);
            }
            return(dt);
        }
コード例 #2
0
        public async Task <SBRecoverFolder> GetRecoverFolder()
        {
            var    response  = new SBRecoverFolder();
            string respuesta = string.Empty;

            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("api-key", AppConfiguration.SbApiKey);
                HttpResponseMessage request = await client.GetAsync(AppConfiguration.EndPointRecoverFolder);

                if (request.IsSuccessStatusCode)
                {
                    respuesta = await request.Content.ReadAsStringAsync();

                    response = JsonConvert.DeserializeObject <SBRecoverFolder>(respuesta);
                }
            }
            return(response);
        }