Exemple #1
0
        private ICollection <LandmarkDto> TryGetLandmarksOfTour(int id)
        {
            ICollection <Landmark>    retrieved = landmarks.GetTourLandmarks(id);
            ICollection <LandmarkDto> dtos      = GetLandmarkDtos(retrieved);

            return(dtos);
        }
Exemple #2
0
        private Tour BuildTour(Dictionary <string, object> rawData)
        {
            int    tourId      = Int32.Parse(rawData["ID"].ToString());
            string title       = rawData["TITLE"].ToString();
            string description = rawData["DESCRIPTION"].ToString();

            Enum.TryParse(rawData["CATEGORY"].ToString(), out TourCategory category);
            char   separator = Path.DirectorySeparatorChar;
            string imagePath = $"{imagesDirectory}{separator}{tourId}.{rawData["IMAGE_EXTENSION"]}";
            ICollection <Landmark> tourStops = landmarks.GetTourLandmarks(tourId);

            Tour tour;

            try
            {
                tour = new Tour(tourId, title, description, tourStops, imagePath, category);
            }
            catch (InvalidTourException)
            {
                throw new CorruptedDataException();
            }
            return(tour);
        }