private WorkoutHistory CloneWorkoutHistory(WorkoutHistory wh) { var workoutHistory = new WorkoutHistory(); foreach (var m in wh.MuscleExercises) { var me = new MuscleExercises { MuscleType = m.MuscleType }; foreach (var e in m.Exercises) { var ne = new WorkoutExercise { Name = e.Name }; foreach (var s in e.Sets) { ne.Sets.Add(new Set() { Reps = s.Reps, Rest = s.Rest }); } me.Exercises.Add(ne); } workoutHistory.MuscleExercises.Add(me); } return(workoutHistory); }
public MuscleExerciseViewModel(MuscleExercises muscleExercises) { Id = muscleExercises.Id; MuscleType = muscleExercises.MuscleType; Exercises = muscleExercises.Exercises.Select(x => new ExerciseViewModel(x)).ToList(); }