public IEnumerable <GroupWithTime> LoadTimingValues()
        {
            if (string.IsNullOrEmpty(CurrentContext.CurrentRaceTitle))
            {
                return(null);
            }

            return(ConvertModelToDto(_raceService.LoadCurrentRace().Groups));
        }
        public Dto.Result LoadResult()
        {
            if (string.IsNullOrEmpty(CurrentContext.CurrentRaceTitle))
            {
                return(null);
            }

            return(ConvertModelToDto(_raceService.LoadCurrentRace()));
        }
示例#3
0
 public Race LoadRace()
 {
     if (string.IsNullOrEmpty(CurrentContext.CurrentRaceTitle))
     {
         return(ConvertModelToDto(_raceService.CreateEmptyRace()));
     }
     else
     {
         return(ConvertModelToDto(_raceService.LoadCurrentRace()));
     }
 }
示例#4
0
        public IEnumerable <Group> GetAllGroupsOfRace()
        {
            if (string.IsNullOrEmpty(CurrentContext.CurrentRaceTitle))
            {
                return(new List <Group>());
            }

            var allGroups = _raceService.LoadCurrentRace().Groups;

            return(GroupConverter.ConvertModelToDto(allGroups));
        }
        public IEnumerable <Participant> GetAllParticipantsOfRace()
        {
            if (string.IsNullOrEmpty(CurrentContext.CurrentRaceTitle))
            {
                return(new List <Participant>());
            }

            var currentRace = _raceService.LoadCurrentRace();

            var allParticipants = currentRace.Groups
                                  .Where(y => y.Participant1 != null)
                                  .Select(x => x.Participant1)
                                  .Union(currentRace.Groups
                                         .Where(y => y.Participant2 != null)
                                         .Select(x => x.Participant2));

            return(ConvertModelToDto(allParticipants));
        }
示例#6
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());
            }
        }