public ChampionViewModel GetChampionByID(int id)
        {
            Champion champion = new Champion();
            ChampionViewModel championVM = new ChampionViewModel();
            ChampionBLL cBLL = new ChampionBLL();

            champion = cBLL.GetChampionByID(id);
            championVM = AutoMapper.Mapper.Map<Champion, ChampionViewModel>(champion);

            return championVM;
        }
Example #2
0
        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;
        }