Exemple #1
0
        public ActionResult Index()
        {
            var wk = _workoutService.CurrentWorkout();

            if (wk != null)
            {
                var summary = _viewFactory.Load(wk.WorkoutId);
                return(View(summary));
            }
            else
            {
                return(View("PromptForNew"));
            }
        }
Exemple #2
0
        public void Handle(AddStrengthCommand command)
        {
            var wk = _workoutService.CurrentWorkout();
            var ex = _exerciseRepository.Load(command.ExerciseId);

            if (wk == null)
            {
                throw new ApplicationException("No current workout");
            }
            wk.AddStrengthSegment(new StrengthSegment(command.ExerciseId, ex.Description, command.Weight, command.Repetitions, command.Notes));
        }
        public void Handle(AddCardioCommand command)
        {
            var wk = _workoutService.CurrentWorkout();
            var ex = _exerciseRepository.Load(command.ExerciseId);

            if (wk == null)
            {
                throw new ApplicationException("No current workout");
            }


            wk.AddCardioSegment(new CardioSegment(command.ExerciseId, ex.Description, command.Duration, command.Level, command.Notes));
        }
 public void Handle(EndWorkoutCommand command)
 {
     _workoutService.CurrentWorkout().SetEndDate(command.EndDate);
 }