public ActionResult ActiveAthletes()
        {
            var request = new GetExercisesOfTheDayRequest();
            var response = _statisticsService.GetExercisesOfTheDay(request);

            var workoutOfTheDayViewModel =
                new WorkoutOfTheDayViewModelBuilder()
                    .WithValues(response.Exercises)
                    .Build();

            ViewBag.WorkoutOfTheDayActive = "active";
            return View(workoutOfTheDayViewModel);
        }
예제 #2
0
        public GetExercisesOfTheDayResponse GetExercisesOfTheDay(GetExercisesOfTheDayRequest request)
        {
            var exercises = _unitOfWork.ExerciseRepository.Get();

            var response = new GetExercisesOfTheDayResponse
            {
                Exercises = exercises
            };

            if (request.WithAthleteStatistics)
            {
                response.AthleteStatistics =
                    _unitOfWork
                    .AthleteStatisticsRepository
                    .Get(t => t.AthleteId == request.AthleteId);

                response.Athlete = _unitOfWork.AthleteRepository.GetById(request.AthleteId);
            }

            return response;
        }