public async Task <int> CreateWorkoutProgramAsync(ExerciseComplexity complexity, string userId)
        {
            var workoutProgram = new WorkoutProgram
            {
                ExerciseComplexity = complexity,
                ApplicationUserId  = userId,
            };

            await this.workoutRepository.AddAsync(workoutProgram);

            await this.workoutRepository.SaveChangesAsync();

            var exercises = await this.exercisesRepository
                            .All()
                            .Where(e => e.ExerciseComplexity == complexity)
                            .ToListAsync();

            foreach (var exercise in exercises)
            {
                var exercisesWorkoutProgram = new ExerciseWorkoutProgram
                {
                    ExerciseId       = exercise.Id,
                    WorkoutProgramId = workoutProgram.Id,
                };

                await this.exercisesWorkoutsRepository.AddAsync(exercisesWorkoutProgram);

                await this.exercisesWorkoutsRepository.SaveChangesAsync();
            }

            return(workoutProgram.Id);
        }
        public async Task <int> CreateExerciseAsync(
            string name,
            string instructions,
            ExerciseComplexity complexity)
        {
            var exercise = new Exercise
            {
                Name               = name,
                Instructions       = instructions,
                ExerciseComplexity = complexity,
            };

            await this.exercisesRepository.AddAsync(exercise);

            await this.exercisesRepository.SaveChangesAsync();

            return(exercise.Id);
        }
        public async Task <int> ModifyAsync(
            int id,
            string name,
            string instructions,
            ExerciseComplexity complexity)
        {
            var exercise = await this.exercisesRepository
                           .All()
                           .Where(d => d.Id == id)
                           .FirstOrDefaultAsync();

            exercise.Name               = name;
            exercise.Instructions       = instructions;
            exercise.ExerciseComplexity = complexity;

            this.exercisesRepository.Update(exercise);
            await this.exercisesRepository.SaveChangesAsync();

            return(exercise.Id);
        }