Ejemplo n.º 1
0
        public async Task <IEnumerable <ExerciseResponse> > GetExerciseResponsesForWorkoutAsync(int workoutId,
                                                                                                WorkoutExerciseParams workoutExerciseParams)
        {
            var workout = await _workoutRepo.GetWorkoutResponseAsync(workoutId);

            IEnumerable <ExerciseResponse> exercises = new List <ExerciseResponse>(workout.Exercises);

            _ = workout ?? throw new KeyNotFoundException($"Workout with the id: {workoutId} does not exist");

            if (workoutExerciseParams.Shuffle)
            {
                exercises = _shuffleService.ShuffleListAsync(workout.Exercises);
            }

            exercises = exercises.OrderBy(x => x.IsCompleted);
            return(exercises);
        }
Ejemplo n.º 2
0
 public async Task <WorkoutResponse> GetWorkoutResponseAsync(int id)
 {
     return(await _workoutRepo.GetWorkoutResponseAsync(id));
 }