public static async Task <Day> MapOldSchedule(ProgramacionOld schedule, string day) { var programacion = new Day(); programacion.day = new List <Series>(); programacion.day = schedule.monday != null ? schedule.monday : schedule.tuesday != null ? schedule.tuesday : schedule.wednesday != null ? schedule.wednesday : schedule.thursday != null ? schedule.thursday : schedule.friday != null ? schedule.friday : schedule.saturday != null ? schedule.saturday : schedule.sunday; return(programacion); }
public async Task <ProgramacionOld> Programacion(string day) { using (HttpClient AruppiClient = new HttpClient()) { string url = _iconfiguration.GetSection("Keys").GetSection("UrlBase").Value + $"schedule/{day}"; AruppiClient.BaseAddress = new Uri(url); StringBuilder path = new StringBuilder(url); ProgramacionOld respuesta = new ProgramacionOld(); using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, new Uri(path.ToString()))) { try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpResponseMessage response = await AruppiClient.GetAsync(url); string jsonString = response.Content.ReadAsStringAsync().Result; if (response.IsSuccessStatusCode && response.StatusCode.Equals(System.Net.HttpStatusCode.OK)) { respuesta = JsonConvert.DeserializeObject <ProgramacionOld>(jsonString); } else { throw new Exception(); } } catch (Exception ex) { throw ex; } return(respuesta); } } }