public static IEnumerable <ClubMemberListItemVM> buildVM(IEnumerable <ClassLibrary1.memberList> listIN) { var vm = listIN.Select(m => new ClubMemberListItemVM { Name = m.Name, Distance = RaceDetails.GetByRaceNameByMeters((double)m.Distance), Time = RaceDetails.formatResult(m.Time), Id = m.Id } ).AsEnumerable(); return(vm); }
public List <SelectListItem> buildSelectRaceList() { List <SelectListItem> slist = new List <SelectListItem>(); var races = new RaceDetails(); races.BuildTestList(); foreach (var item in races.list) { var option = new SelectListItem() { Text = item.title, Value = item.meters.ToString() }; slist.Add(option); } return(slist); }
public static List <RaceTimesVM> buildList(IEnumerable <race> listofraces, double targetdistance) { List <RaceTimesVM> list = new List <RaceTimesVM>(); list = listofraces.Select(s => new RaceTimesVM { lastRaceId = s.Id, lastRaceDistance = RaceDetails.GetByRaceNameByMeters(s.distance), lastRaceTime = RaceDetails.formatResult(s.time), //predictedTime = RaceDetails.formatResult(Convert.ToInt32(RaceDetails.calcPredictedTime(s.distance, , s.time) + RaceDetails.cameron(s.distance, 8046.72, s.time)) / 2), //predictedRaw = (RaceDetails.calcPredictedTime(s.distance, 8046.72, s.time) + RaceDetails.cameron(s.distance, 8046.72, s.time)) / 2 predictedTime = RaceDetails.formatResult(Convert.ToInt32(RaceDetails.calcPredictedTime(s.distance, targetdistance, s.time) + RaceDetails.cameron(s.distance, targetdistance, s.time)) / 2), predictedRaw = (RaceDetails.calcPredictedTime(s.distance, targetdistance, s.time) + RaceDetails.cameron(s.distance, targetdistance, s.time)) / 2 } ).ToList(); return(list); }
public static string CalcSimpleAve(List <RaceTimesVM> list) { double avg; if (list.Count > 1) { double sum = 0.0; double count = 0.0; foreach (var r in list) { sum = r.predictedRaw + sum; count++; } avg = sum / count; } else { avg = list.First().predictedRaw; } return(RaceDetails.formatResult(Convert.ToInt32(avg))); }