示例#1
0
        public FastestPathDTO SearchFastestConnections(SearchInputDTO searchInputDTO)
        {
            _searchValidator.Validate(searchInputDTO);
            var searchInput        = _searchInputManualMapper.ToDomain(searchInputDTO);
            var stops              = _stopRepository.GetAllConnectedToAnyLine();
            var stopGraph          = _graphGenerator.CreateGraph(stops, searchInput.StartDate);
            var fastestConnections = _connectionSearchEngine.SearchConnections(searchInput, stopGraph);
            var fastestPath        = _fastestPathResolver.ResolveFastestPath(searchInput, fastestConnections);
            var fastestPathDTO     = Mapper.Map <FastestPath, FastestPathDTO>(fastestPath);

            fastestPathDTO.PathDescription = _fastestPathDescriptionWriter.WriteDescription(searchInput, fastestPath);
            return(fastestPathDTO);
        }
示例#2
0
        public JsonResult SearchConnections(SearchInputDTO searchInput)
        {
            FastestPathDTO fastestPath = null;

            try
            {
                fastestPath = _searchManager.SearchFastestConnections(searchInput);
            }
            catch (Exception ex)
            {
                return(Json(new { error = ex.Message }));
            }
            return(Json(fastestPath));
        }