public ActionResult Index() { var wk = _workoutService.CurrentWorkout(); if (wk != null) { var summary = _viewFactory.Load(wk.WorkoutId); return(View(summary)); } else { return(View("PromptForNew")); } }
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); }