Example #1
0
        /// <summary>
        /// Create a new <see cref="TripReport"/> from a <see cref="WtaTripReport"/>
        /// </summary>
        /// <param name="wtaReportId">The WTA ID extracted from the trip report.</param>
        /// <param name="wtaReport">The <see cref="WtaTripReport"/> used to build the new report object.</param>
        /// <returns>An initialized <see cref="TripReport"/>.</returns>
        private TripReport CreateReport(string wtaReportId, WtaTripReport wtaReport)
        {
            int tripTypeId = this._tripTypeDictionary[wtaReport.HikeType];

            TripReport report = new TripReport
            {
                WtaId = wtaReportId,
                Title = wtaReport.Title,
                Author = wtaReport.Author,
                Date = wtaReport.Date,
                Url = wtaReport.FullReportUrl,
                TripTypeId = tripTypeId,
                Text = wtaReport.BodyText,
            };

            foreach (Uri photoUrl in wtaReport.Photos)
            {
                report.Photos.Add(new TripReportPhoto
                {
                    Url = photoUrl,
                });
            }

            return report;
        }
Example #2
0
 /// <summary>
 /// Retrieve the WTA ID for the trip report.
 /// </summary>
 /// <param name="report">The report to retrieve the ID of.</param>
 /// <returns>The unique ID of the trip report.</returns>
 private string ParseWtaReportId(WtaTripReport report)
 {
     return report.FullReportUrl.Segments.Last();
 }