public void AddTravel(Travel travel) { Travel newTravel = TravelsList.FirstOrDefault(x => x.Id == travel.Id); if (newTravel == null) { TravelsList.Add(travel); } else { newTravel.Copy(travel); } }
/// <summary> /// Полное клонирование объекта путешествия, нужно для сохранения /// </summary> /// <returns></returns> public object Clone() { Travel travel = new Travel() { Id = this.Id, Name = this.Name, People = this.People }; travel.Transfers = new List <Transfer>(); travel.Accommodation = new List <Accommodation>(); foreach (var transfer in this.Transfers) { travel.Transfers.Add(transfer.Clone() as Transfer); } foreach (var accommodation in this.Accommodation) { travel.Accommodation.Add(accommodation.Clone() as Accommodation); } return(travel); }
public void RemoveTravel(Travel travel) { TravelsList.Remove(travel); }
public void SetCurrentTravel(Travel travel) { CurrentTravel = travel; }