Exemple #1
0
        public void AddTravel(Travel travel)
        {
            Travel newTravel = TravelsList.FirstOrDefault(x => x.Id == travel.Id);

            if (newTravel == null)
            {
                TravelsList.Add(travel);
            }
            else
            {
                newTravel.Copy(travel);
            }
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
 public void RemoveTravel(Travel travel)
 {
     TravelsList.Remove(travel);
 }
Exemple #4
0
 public void SetCurrentTravel(Travel travel)
 {
     CurrentTravel = travel;
 }