/// <summary>
        /// Initializes a new instance of the CheckListViewModel class.
        /// </summary>
        public CheckListViewModel(INavigationService navigationService)
        {
            Messenger.Default.Register<Tour>(this,
              tour =>
              {
              DataServiceTour dsTour = new DataServiceTour();
              Tour = dsTour.getTourById(tour.Id);
              RepairList = new ObservableCollection<Repair>(tour.Repair);
              PictureTourList = new ObservableCollection<PictureTour>(tour.Pictures);
              NearByList = new ObservableCollection<NearBy>(tour.NearBy);

              RecentRenovations = new ObservableCollection<RecentRenov>();
              foreach (var item in Utils.Utility.StringToList(tour.RecentRenovations))
              {
              RecentRenovations.Add(new RecentRenov(){Name= item});
              }
              RaisePropertyChanged("HasLand");
              EditableObject = new Caretaker<Tour>(this.Tour);
              EditableObject.BeginEdit();
              IsFormValid = false;
              });
            this.navigationService = navigationService;
        }
 private void DeleteTour(object tour)
 {
     DataServiceTour dsTour = new DataServiceTour();
     if (tour is Tour)
     {
         this.TourList.Remove(tour as Tour);
         dsTour.DeleteTour(tour as Tour);
     }
     else if (tour is List<Tour>)
     {
         foreach (Tour tour_Loop in tour as List<Tour>)
         {
             this.TourList.Remove(tour_Loop as Tour);
             dsTour.DeleteTour(tour_Loop);
         }
     }
 }
        public void SetTourList()
        {
            DataServiceTour dsTour = new DataServiceTour();
            this.TourList = dsTour.LoadTours();

            if (FilterBy.CurrentTourType != TourType.AllTourType)
            {
                this.TourList = this.TourList.Where(x => x.Type == FilterBy.CurrentTourType).ToList();
            }

            if (FilterBy.CurrentEstate != EstateType.AllEstateType)
            {
                this.TourList = this.TourList.Where(x => x.EstateType == FilterBy.CurrentEstate).ToList();
            }
        }
 public void EditTour()
 {
     DataServiceTour tour = new DataServiceTour();
     tour.UpdateTour();
 }
 public void AddTour()
 {
     DataServiceTour tour = new DataServiceTour();
     tour.addTour(this.Tour);
 }
        private void SaveCheckList()
        {
            IsFormValid = true;

            this.Tour.RecentRenovations = Utils.Utility.ListToString(RecentRenovations.Select(reno => reno.Name).ToList());
            DataServiceTour dsTour = new DataServiceTour();
            dsTour.UpdateTour();
            EditableObject.EndEdit();
            navigationService.GoBack();
        }
 private void Cancel()
 {
     EditableObject.CancelEdit();
     DataServiceTour dsTour = new DataServiceTour();
     dsTour.RefreshTour(this.Tour);
 }