public bool LetGo(FreightTransport trensport) { if (transport != null) foreach (Transport e in transport) { if (e == trensport || trensport.GosNum==e.GosNum) //не знаю как лучше { //if(e.InPark!=true) //{ // throw new ArgumentException(); // return false; //} e.InPark = false; return true; } } return false; }
public bool AddTransport(FreightTransport trensport) { try { List<Transport> listTrans; if (transport != null) listTrans = transport.ToList(); else { listTrans = new List<Transport>(); } listTrans.Add(trensport); this.transport = listTrans.ToArray(); return true; } catch { return false; } }