private static Deporte ConvertToDeporte(DataRow dr) { Deporte dp = new Deporte(); if (dr != null) { dp.DeporteId = Convert.ToInt32(dr["DeporteId"]); dp.DeporteDescripcion = Convert.ToString(dr["Deporte"]); } return(dp); }
public static List <Deporte> GetDeportes(int eventoId) { List <Deporte> dep = new List <Deporte>(); //DataTable dt = new DataTable(); DataTable dt1 = new DataTable(); DBTransaction db = new DBTransaction(); DataTable dt = db.GetDataView(string.Format("prog.fDeportes ({0})", eventoId)); DataView view = new DataView(dt); view.Sort = "Deporte"; dt1 = view.ToTable();; foreach (DataRow dr in dt1.Rows) { Deporte dp = ConvertToDeporte(dr); dep.Add(dp); } return(dep); }