public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var allExercises = values[0] as IEnumerable <Exercise>; var allWeightEntries = values[1] as IEnumerable <WeightEntry>; var currentWeightEntry = values[2] as WeightEntry; var exercise = WeightEntryExercisesConverter.Convert(allExercises, allWeightEntries, currentWeightEntry); var distanceRun = exercise.Sum(p => p.Distance); return(distanceRun); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var allExercises = values[0] as IEnumerable <Exercise>; var allWeightEntries = values[1] as IEnumerable <WeightEntry>; var currentWeightEntry = values[2] as WeightEntry; var exercises = WeightEntryExercisesConverter.Convert(allExercises, allWeightEntries, currentWeightEntry); var timeTaken = TimeSpan.FromSeconds(exercises.Sum(p => p.TimeTaken.TotalSeconds)); return(timeTaken); }