private List <Race_Schedule> PopulateScheduleList(IDbCommand cmd) { using (IDataReader idr = cmd.ExecuteReader()) { List <Race_Schedule> _sched = new List <Race_Schedule>(); while (idr.Read()) { Race_Schedule sched = new Race_Schedule(); sched.ID = Helper.GetInt32(idr, "schedule_id"); sched.Description = Helper.GetString(idr, "schedule_long_description"); sched.Schedule_Year = Helper.GetInt32(idr, "schedule_year"); sched.Start_Date = Helper.GetDateTime(idr, "schedule_start_date"); sched.End_Date = Helper.GetDateTime(idr, "schedule_end_date"); sched.Series = new Race_Series { ID = Helper.GetInt32(idr, "series_id"), Description = Helper.GetString(idr, "series_description"), Series_Name = Helper.GetString(idr, "series_description") }; sched.Track = new Race_Track { ID = Helper.GetInt32(idr, "track_id"), Description = Helper.GetString(idr, "track_name"), Track_Name = Helper.GetString(idr, "track_name") }; _sched.Add(sched); } return(_sched); } }
ScheduleViewModel MapModelToViewModel(Race_Schedule m) { return(new ScheduleViewModel { Schedule = m, Results = _resultsService.GetResultsBySchedule(m.ID).ToList() }); }