public static ITrackTimeStatistic GetTrackTimeStatistic() { var tracks = Logic.Factory.GetALlTracks(); var result = new Marketing.Models.TrackTimeStatistic { Longest = tracks.Where(t1 => t1.Milliseconds == tracks.Max(t2 => t2.Milliseconds)).FirstOrDefault(), Shortest = tracks.Where(t1 => t1.Milliseconds == tracks.Min(t2 => t2.Milliseconds)).FirstOrDefault(), Avg = (float)tracks.Average(t => t.Milliseconds) }; return(result); }
public static Contracts.Report.Marketing.ITrackTimeStatistic GetTrackTimeStatistic() { var tracks = Logic.Factory.GetAllTracks(); var result = new Marketing.Models.TrackTimeStatistic(); result.maxName = tracks.Max().Name; result.maxNumber = tracks.Max().Milliseconds.ToString(); result.minName = tracks.Min().Name; result.minNumber = tracks.Min().Milliseconds.ToString(); result.avgNumber = tracks.Average(t => t.Milliseconds).ToString(); return(result); }