Ejemplo n.º 1
0
        public IHttpActionResult SetLanding([FromUri] int judge, [FromUri] int landing)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithScoringModelValidatorBuilder>(currentProvider);

            currentProvider.CurrentScore.SetLandingDeduction(judge, landing);
            return(Ok());
        }
Ejemplo n.º 2
0
        public IHttpActionResult SetAdditionalDeduction([FromUri] int judge, [FromUri] int penalty)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithScoringModelValidatorBuilder>(currentProvider);

            currentProvider.CurrentScore.SetAdditionalDeduction(judge, penalty);
            return(Ok());
        }
Ejemplo n.º 3
0
        public IHttpActionResult SetFlightTime([FromUri] int time)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithScoringModelValidatorBuilder>(currentProvider);

            currentProvider.CurrentScore.Time = time;
            return(Ok());
        }
Ejemplo n.º 4
0
        public IHttpActionResult SetScore([FromUri] int judge, [FromUri] int skill, [FromUri] int deduction)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithSkillValidatorBuilder>(currentProvider, skill);

            currentProvider.CurrentScore.SetSkillDeduction(judge, skill, deduction);
            return(Ok());
        }
Ejemplo n.º 5
0
        public IHttpActionResult SetDifficulty(int difficulty)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithScoringModelValidatorBuilder>(currentProvider);

            currentProvider.CurrentScore.Difficulty = difficulty;
            return(Ok());
        }
Ejemplo n.º 6
0
        public IHttpActionResult MoveToPrevious()
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithEventModelValidator>(currentProvider);

            AthleteModel athleteModel;

            do
            {
                athleteModel = GetPrevious <AthleteModel>();

                // ReSharper disable once InvertIf
                if (null == athleteModel)
                {
                    var previousEvent = GetPrevious <EventModel>();
                    currentProvider.CurrentEvent = previousEvent;

                    if (null == currentProvider.CurrentEvent)
                    {
                        throw new NoCurrentException();
                    }
                }
            } while (null == athleteModel);

            currentProvider.CurrentAthlete = athleteModel;

            if (null == currentProvider)
            {
                throw new NoCurrentException();
            }

            return(Ok());
        }
Ejemplo n.º 7
0
        public IHttpActionResult MoveTo([FromUri] int eventId, [FromUri] int athleteId)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithEventModelValidator>(currentProvider);

            if (null == currentProvider.CurrentEvent || eventId != currentProvider.CurrentEvent.Id)
            {
                var currentEvent = currentProvider.CurrentMeet[eventId];
                currentProvider.CurrentEvent = currentEvent;
            }

            if (null != currentProvider.CurrentEvent)
            {
                var currentAthlete = currentProvider.CurrentEvent[athleteId];
                currentProvider.CurrentAthlete = currentAthlete;
            }
            else
            {
                currentProvider.CurrentAthlete = null;
            }

            if (null == currentProvider.CurrentAthlete)
            {
                throw new NoCurrentException();
            }

            return(Ok());
        }
Ejemplo n.º 8
0
        public Task <Routine> GetScoreDetails()
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithScoringModelValidatorBuilder>(currentProvider);

            var proposed = currentProvider.CurrentScore.ComputeRoutineScore();

            return(Task.FromResult(proposed));
        }
Ejemplo n.º 9
0
        public IHttpActionResult SetNumberOfElementsCompleted([FromUri] int skills = 10)
        {
            ValidatorBuilderHelper.ValidateWith <CurrentProviderWithoutScoringModelValidatorBuilder>(currentProvider);

            var strategy = currentProvider.CurrentEvent.GetComputationStrategy();
            var judges   = currentProvider.CurrentEvent.GetJudgeCount();

            currentProvider.CurrentScore = new ScoreModel(strategy, judges, skills);
            return(Ok());
        }