public InventoryRecord[] GetInventory() { InventoryDAL d = new InventoryDAL(); d.OpenConnection(ConnString); DataTable table = d.GetAllInventoryAsDataTable(); d.CloseConnection(); List <InventoryRecord> records = new List <InventoryRecord>(); DataTableReader reader = table.CreateDataReader(); while (reader.Read()) { InventoryRecord r = new InventoryRecord(); r.ID = (int)reader["CarID"]; r.Color = ((string)reader["Color"]); r.Make = ((string)reader["Make"]); r.PetName = ((string)reader["PetName"]); records.Add(r); } return((InventoryRecord[])records.ToArray()); }
public void InsertCar(InventoryRecord car) { InventoryDAL d = new InventoryDAL(); d.OpenConnection(ConnString); d.InsertAuto(car.ID, car.Color, car.Make, car.PetName); d.CloseConnection(); }