Пример #1
0
        public IActionResult StartTest(Parameters parameters)
        {
            var trainingType  = userTraining[parameters.UserTraining];
            var conditionType = userContition[parameters.UserCondition];

            ITrainingEndCondition trainingEndCondition = null;

            if (conditionType == typeof(TimerTrainingEndCondition))
            {
                trainingEndCondition = (ITrainingEndCondition)Activator.CreateInstance(conditionType, parameters.Time);
            }
            else
            {
                trainingEndCondition = (ITrainingEndCondition)Activator.CreateInstance(conditionType);
            }

            var training = (Training)Activator.CreateInstance(
                trainingType, parameters.UserLevel, trainingEndCondition);

            training.CreateTasks(db, parameters.TasksNumber);
            HttpContext.Session.Set("training", training);
            return(ShowNextTask());
        }
Пример #2
0
 public TextsTraining(Parameters.Levels level, ITrainingEndCondition condition)
     : base(level, condition)
 {
 }
Пример #3
0
 public Training(Parameters.Levels level, ITrainingEndCondition condition)
 {
     Condition    = condition;
     Level        = level;
     СurrentIndex = 0;
 }