public DataTable SetTableCampanasEmail(SBRecoverEmailCampaing listCampanasEmail) { DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("NOMBRE"); dt.Columns.Add("ETIQUETA"); dt.Columns.Add("ASUNTO"); foreach (var item in listCampanasEmail.campaigns) { dt.Rows.Add(item.id, item.name, item.tag, item.subject); } return(dt); }
public async Task <SBRecoverEmailCampaing> GetRecoverAllCampanaEmail() { var response = new SBRecoverEmailCampaing(); 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.EndPointRecoverEmailCampaing); if (request.IsSuccessStatusCode) { respuesta = await request.Content.ReadAsStringAsync(); response = JsonConvert.DeserializeObject <SBRecoverEmailCampaing>(respuesta); } } return(response); }