コード例 #1
0
        private async void AddExerciseToDatabase(int id)
        {
            Exercise exercise1 = ExerciseFactory.CreateExercise("Touwtje springen");

            exercise1.Id = id;
            exercise1.ExerciseRequirements = new List <ExerciseRequirement>()
            {
                ExerciseFactory.CreateExerciseRequirement("Touw")
            };
            exercise1.ExerciseSteps = new List <ExerciseStep>()
            {
                ExerciseFactory.CreateExerciseStep(1, "Spring 30 keer"),
                ExerciseFactory.CreateExerciseStep(2, "Rust"),
                ExerciseFactory.CreateExerciseStep(3, "Spring nog eens 30 keer")
            };
            exercise1.ExerciseForms = new List <ExerciseForm>()
            {
                ExerciseFactory.CreateExerciseForm(MovementForm.springen),
                ExerciseFactory.CreateExerciseForm(MovementForm.balans)
            };
            await this.exerciseRepository.CreateAsync(exercise1);
        }
コード例 #2
0
        private async void FillDatabase(bool withNonRealExercises = true)
        {
            // create first exercise
            Exercise exercise1 = ExerciseFactory.CreateExercise("Touwtje springen");

            exercise1.ExerciseRequirements = new List <ExerciseRequirement>()
            {
                ExerciseFactory.CreateExerciseRequirement("Touw")
            };
            exercise1.ExerciseSteps = new List <ExerciseStep>()
            {
                ExerciseFactory.CreateExerciseStep(1, "Spring 30 keer"),
                ExerciseFactory.CreateExerciseStep(2, "Rust"),
                ExerciseFactory.CreateExerciseStep(3, "Spring nog eens 30 keer")
            };
            exercise1.ExerciseForms = new List <ExerciseForm>()
            {
                ExerciseFactory.CreateExerciseForm(MovementForm.springen),
                ExerciseFactory.CreateExerciseForm(MovementForm.balans)
            };
            await this.exerciseRepository.CreateAsync(exercise1);

            // create second exercise
            Exercise exercise2 = ExerciseFactory.CreateExercise("Voetballen");

            exercise2.ExerciseRequirements = new List <ExerciseRequirement>()
            {
                ExerciseFactory.CreateExerciseRequirement("Voetbal"),
                ExerciseFactory.CreateExerciseRequirement("Voetbalschoenen")
            };
            exercise2.ExerciseSteps = new List <ExerciseStep>()
            {
                ExerciseFactory.CreateExerciseStep(1, "Houd 40 keer hoog"),
                ExerciseFactory.CreateExerciseStep(2, "Rust"),
                ExerciseFactory.CreateExerciseStep(3, "Probeer je record te verbreken")
            };
            exercise2.ExerciseForms = new List <ExerciseForm>()
            {
                ExerciseFactory.CreateExerciseForm(MovementForm.mikken),
                ExerciseFactory.CreateExerciseForm(MovementForm.balans)
            };
            await this.exerciseRepository.CreateAsync(exercise2);

            // create third exercise
            Exercise exercise3 = ExerciseFactory.CreateExercise("Ping pong");

            exercise3.ExerciseRequirements = new List <ExerciseRequirement>()
            {
                ExerciseFactory.CreateExerciseRequirement("Ping pong batjes"),
                ExerciseFactory.CreateExerciseRequirement("Ping pong balletje")
            };
            exercise3.ExerciseSteps = new List <ExerciseStep>()
            {
                ExerciseFactory.CreateExerciseStep(1, "Probeer de ping pong bal 20 keer hoog te houden"),
                ExerciseFactory.CreateExerciseStep(2, "Probeer het nog eens"),
                ExerciseFactory.CreateExerciseStep(3, "Ben je niet alleen? Probeer dan een 1 v 1")
            };
            exercise3.ExerciseForms = new List <ExerciseForm>()
            {
                ExerciseFactory.CreateExerciseForm(MovementForm.mikken)
            };
            await this.exerciseRepository.CreateAsync(exercise3);

            if (withNonRealExercises)
            {
                // create exercise without requirements
                Exercise exercise4 = ExerciseFactory.CreateExercise("Exercise zonder benodigdheden");
                exercise4.ExerciseRequirements = new List <ExerciseRequirement>()
                {
                };
                exercise4.ExerciseSteps = new List <ExerciseStep>()
                {
                    ExerciseFactory.CreateExerciseStep(1, "Step1")
                };
                exercise4.ExerciseForms = new List <ExerciseForm>()
                {
                    ExerciseFactory.CreateExerciseForm(MovementForm.springen)
                };
                await this.exerciseRepository.CreateAsync(exercise4);

                // create exercise without steps
                Exercise exercise5 = ExerciseFactory.CreateExercise("Exercise zonder stappen");
                exercise5.ExerciseRequirements = new List <ExerciseRequirement>()
                {
                    ExerciseFactory.CreateExerciseRequirement("Requirement1")
                };
                exercise5.ExerciseSteps = new List <ExerciseStep>()
                {
                };
                exercise5.ExerciseForms = new List <ExerciseForm>()
                {
                    ExerciseFactory.CreateExerciseForm(MovementForm.springen)
                };
                await this.exerciseRepository.CreateAsync(exercise5);

                // create exercise without movement forms
                Exercise exercise6 = ExerciseFactory.CreateExercise("Exercise zonder beweegvormen");
                exercise6.ExerciseRequirements = new List <ExerciseRequirement>()
                {
                    ExerciseFactory.CreateExerciseRequirement("Requirement1")
                };
                exercise6.ExerciseSteps = new List <ExerciseStep>()
                {
                    ExerciseFactory.CreateExerciseStep(1, "Step1")
                };
                exercise6.ExerciseForms = new List <ExerciseForm>()
                {
                };
                await this.exerciseRepository.CreateAsync(exercise6);
            }
        }