private List <string> obtenerHorarios() { try { List <string> hor = new List <string>(); HorariosController controller = new HorariosController(); List <HorarioModel> horarios = controller.ConnectGET(); foreach (HorarioModel temp in horarios) { hor.Add(temp.Dia + " " + temp.HoraInicio.ToString() + " - " + temp.HoraFinal.ToString()); } return(hor); } catch (Exception ex) { throw ex; } }
private string obtenerUnHorario(string id) { try { HorariosController controller = new HorariosController(); List <HorarioModel> horarios = controller.ConnectGET(); foreach (HorarioModel item in horarios) { if (item.Codigo == Int32.Parse(id)) { return(item.Dia + " " + item.HoraInicio.ToString() + " - " + item.HoraFinal.ToString()); } } return("Sin Nombre"); } catch (Exception ex) { throw ex; } }
public string obtenerHorariosModificar() { try { StringBuilder sb = new StringBuilder(); HorariosController controller = new HorariosController(); List <HorarioModel> horarios = controller.ConnectGET(); foreach (HorarioModel item in horarios) { string horario = item.Dia + " " + item.HoraInicio.ToString() + " - " + item.HoraFinal.ToString(); sb.Append(string.Format("'{0}':'{1}',", item.Codigo, horario)); } return("{" + sb.ToString() + "}"); } catch (Exception ex) { throw ex; } }