Exemplo n.º 1
0
        private async Task CreateSteps(ExerciseBody exerciseBody, Exercise newExercise)
        {
            // delete old
            await exerciseRepository.DeleteStepsAsync(newExercise.Id);

            // create new
            newExercise.ExerciseSteps = new List <ExerciseStep>();
            int stepCount = 1;

            foreach (string step in exerciseBody.Steps)
            {
                ExerciseStep newStep = new ExerciseStep
                {
                    Exercise        = newExercise,
                    StepNumber      = stepCount,
                    StepDescription = step
                };
                newExercise.ExerciseSteps.Add(newStep);
                stepCount++;
            }
        }