private ExerciseViewModel MapExercise(Exercise model) { var sets = new List<SetViewModel>(); foreach (var set in model.Sets) { sets.Add(MapSet(set)); } var viewModel = new ExerciseViewModel { Id = model.Id, Comment = model.Comment, ExerciseType = model.ExerciseType, Sets = sets }; return viewModel; }
private Exercise MapExerciseViewModel(ExerciseViewModel model) { var sets = new List<Set>(); foreach (var set in model.Sets) { sets.Add(MapSetViewModel(set)); } var exercise = new Exercise { Id = model.Id, Comment = model.Comment, ExerciseType = model.ExerciseType, Sets = sets }; return exercise; }