public bool Insert(AirLine airline) { int autonumber = 0; AirLineDAC airlineComponent = new AirLineDAC(); bool endedSuccessfuly = airlineComponent.InsertNewAirLine( ref autonumber, airline.Name); if(endedSuccessfuly) { airline.ID = autonumber; } return endedSuccessfuly; }
public AirLine GetByID(int _iD) { AirLineDAC _airLineComponent = new AirLineDAC(); IDataReader reader = _airLineComponent.GetByIDAirLine(_iD); AirLine _airLine = null; while(reader.Read()) { _airLine = new AirLine(); if(reader["ID"] != DBNull.Value) _airLine.ID = Convert.ToInt32(reader["ID"]); if(reader["Name"] != DBNull.Value) _airLine.Name = Convert.ToString(reader["Name"]); _airLine.NewRecord = false; } reader.Close(); return _airLine; }
public List<AirLine> GetAll() { AirLineDAC _airLineComponent = new AirLineDAC(); IDataReader reader = _airLineComponent.GetAllAirLine().CreateDataReader(); List<AirLine> _airLineList = new List<AirLine>(); while(reader.Read()) { if(_airLineList == null) _airLineList = new List<AirLine>(); AirLine _airLine = new AirLine(); if(reader["ID"] != DBNull.Value) _airLine.ID = Convert.ToInt32(reader["ID"]); if(reader["Name"] != DBNull.Value) _airLine.Name = Convert.ToString(reader["Name"]); _airLine.NewRecord = false; _airLineList.Add(_airLine); } reader.Close(); return _airLineList; }
public bool Update(AirLine airline ,int old_iD) { AirLineDAC airlineComponent = new AirLineDAC(); return airlineComponent.UpdateAirLine( airline.Name, old_iD); }