Example #1
0
        public async Task <ArrivalTimeRespDto> GetArrivalTime(int routeId, int waypointId)
        {
            var tourEntity = await _tourRepository.LoadTour(routeId);

            var stops = tourEntity.Stops
                        .OrderBy(s => s.WayPointIndex);
            var currentStopEntity = stops.Where(s => s.WayPointIndex == waypointId).First();
            var nextStopEntity    = stops.Where(s => s.WayPointIndex > waypointId).First();
            var currentStop       = _mappingService.MapToClass(currentStopEntity);
            var nextStop          = _mappingService.MapToClass(nextStopEntity);

            var travelTime = _travelService.GetTravelTime(currentStop, nextStop);

            return(new ArrivalTimeRespDto
            {
                ArrivalTime = DateTime.Now.AddSeconds(travelTime),
                WaypointId = nextStopEntity.WayPointIndex
            });
        }
        public async Task <RouteRespDto> LoadTour(int routeId, bool geoJson)
        {
            var tourEntity = await _tourRepository.LoadTour(routeId);

            return(_mappingService.MapToDto(tourEntity, geoJson));
        }