public Champion GetChampionByID(int id) { DataTable dTable = new DataTable(); Champion champion = new Champion(); ChampionDAL cDAL = new ChampionDAL(); string cmd = "SELECT * FROM LOLBG.Champions WHERE ID = " + id.ToString(); dTable = cDAL.GetSqlQueryResults(cmd); //Map the query resulted data table to the champion class: champion = AutoMapper.Mapper.DynamicMap<IDataReader, List<Champion>>(dTable.CreateDataReader()).First(); return champion; }
public List<Champion> GetAllChampions() { DataTable dTable = new DataTable(); List<Champion> championList = new List<Champion>(); ChampionDAL cDAL = new ChampionDAL(); string cmd = "SELECT * FROM LOLBG.Champions"; //Create the command to query for the sql data table dTable = cDAL.GetSqlQueryResults(cmd); //Get the data table //Map the query resulted data table to the champion class: championList = AutoMapper.Mapper.DynamicMap<IDataReader, List<Champion>>(dTable.CreateDataReader()); return championList; }