public Item GetItemByID(int id) { Item item = new Item(); DataTable dTable = new DataTable(); ItemDAL iDAL = new ItemDAL(); string cmd; cmd = "SELECT * FROM LOLBG.Items WHERE IsDeleted = 0 AND ID = " + id.ToString(); dTable = iDAL.GetSqlQueryResults(cmd); item = AutoMapper.Mapper.Map<IDataReader, List<Item>>(dTable.CreateDataReader()).First(); return item; }
public List<Item> GetAllItems() { List<Item> itemList = new List<Item>(); DataTable dTable = new DataTable(); ItemDAL iDAL = new ItemDAL(); string cmd; cmd = "SELECT * FROM LOLBG.Items WHERE IsDeleted = 0"; dTable = iDAL.GetSqlQueryResults(cmd); itemList = AutoMapper.Mapper.Map<IDataReader, List<Item>>(dTable.CreateDataReader()); return itemList; }