Exemple #1
0
        public async Task <LogisticCenterDto> ProcessLogisticCenter()
        {
            var paths = await _pathRepository.GetPaths();

            var currentLogisticCenter = (await _logisticCenterRepository.GetLogisticCenters()).LastOrDefault();
            var sum = paths.Sum(x => x.GetHashCode());

            if (sum == currentLogisticCenter?.CheckSum || sum == 0)
            {
                return(currentLogisticCenter);
            }

            var pathsCount = GetPathsCount(paths);
            var cityResult = GetCityLogisticCenter(pathsCount);

            var logisticCenter = new LogisticCenterDto {
                Name = cityResult.Name, CheckSum = sum
            };
            await _logisticCenterRepository.InsertLogisticCenter(logisticCenter);

            return(logisticCenter);
        }
Exemple #2
0
        public async Task <IEnumerable <PathDto> > Get()
        {
            var results = await _pathRepository.GetPaths();

            return(results);
        }