public static IWorkout CovertTPWorkoutToInternal(Workout tpWorkout) { IWorkout internalWorkout; switch (tpWorkout.WorkoutTypeDescription) { case "Swim": { internalWorkout = MapSwimWorkout(tpWorkout); break; } case "Bike": { internalWorkout = MapCycleWorkout(tpWorkout); break; } case "Run": { internalWorkout = MapRunWorkout(tpWorkout); break; } case "Custom": { internalWorkout = MapCustomWorkout(tpWorkout); break; } default: { internalWorkout = new CustomWorkout(); break; } } return internalWorkout; }
public static IWorkout MapCustomWorkout(Workout tpWorkout) { ICustomWorkout customWorkout = new CustomWorkout(); customWorkout.TPWorkoutID = tpWorkout.WorkoutId; customWorkout.StartDate = tpWorkout.WorkoutDay; customWorkout.StartTime = tpWorkout.StartTime; if (tpWorkout.TimeTotalInSeconds.HasValue) customWorkout.Duration = new TimeSpan(0, 0, (int)tpWorkout.TimeTotalInSeconds); return customWorkout; }