Exemple #1
0
        private void Race(string[] input)
        {
            if (input.Length < 2)
            {
                logger.Info("Invalid input, redirect to Races Menu");
                Race();
                return;
            }

            if (input[0] == "l")
            {
                DoAction(_raceService.SetCurrentRace, input.Skip(1));
                return;
            }

            if (input[0] == "t")
            {
                DoAction(_raceService.SetStartTime, input.Skip(1));
                return;
            }

            if (input[0] == "ag")
            {
                AddGroup(input.Skip(1).ToArray());
                return;
            }

            if (input[0] == "at")
            {
                var currentRace  = _raceService.LoadCurrentRace();
                var timingValues = _timingValueService.LoadLatestValuesFromRaceFolder(currentRace.Titel);
                _raceService.AddTimingValues(currentRace, timingValues);
                return;
            }

            if (input[0] == "c")
            {
                TryCreateNewRace(input.Skip(1).ToArray());
            }
        }
        public IEnumerable <GroupWithTime> Assign([FromBody] IEnumerable <Dto.TimingValue> timingValues)
        {
            var newTimingValues = ConvertTimingValuesDtoToModel(timingValues).ToList();
            var currentRace     = _raceService.LoadCurrentRace();

            _timingValueService.SaveChangesToRaceFolder(currentRace, newTimingValues);

            _raceService.AddTimingValues(currentRace, newTimingValues);
            _raceService.CalculateFinishTimes(currentRace);
            _raceService.UpdateRace(currentRace);

            return(ConvertModelToDto(currentRace.Groups));
        }