Example #1
0
        public JsonAthletePRs(Athlete athlete)
        {
            var allTimePRs = athlete.Records.First(r => r.Year == "All Time");

            Name        = athlete.Name;
            Class       = athlete.Class;
            Braemar     = allTimePRs.Braemar;
            Open        = allTimePRs.Open;
            HeavyWeight = allTimePRs.HeavyWeight;
            LightWeight = allTimePRs.LightWeight;
            HeavyHammer = allTimePRs.HeavyHammer;
            LightHammer = allTimePRs.LightHammer;
            Caber       = allTimePRs.Caber;
            Sheaf       = allTimePRs.Sheaf;
            Wfh         = allTimePRs.Wfh;
        }
        public AthleteRecordsViewModel(Athlete athlete)
        {
            Name  = athlete.Name;
            Class = athlete.Class;
            List <Athlete.Record> orderedRecords = athlete.Records.OrderByDescending(c => c.Year).ToList();

            Years             = orderedRecords.Select(y => y.Year).ToList();
            Ranks             = orderedRecords.Select(r => r.Rank).ToList();
            BraemarThrows     = orderedRecords.Select(b => b.Braemar).ToList();
            OpenThrows        = orderedRecords.Select(o => o.Open).ToList();
            HeavyWeightThrows = orderedRecords.Select(h => h.HeavyWeight).ToList();
            LightWeightThrows = orderedRecords.Select(l => l.LightWeight).ToList();
            HeavyHammerThrows = orderedRecords.Select(hh => hh.HeavyHammer).ToList();
            LightHammerThrows = orderedRecords.Select(lh => lh.LightHammer).ToList();
            CaberPoints       = orderedRecords.Select(c => c.Caber).ToList();
            SheafThrows       = orderedRecords.Select(s => s.Sheaf).ToList();
            WfhThrows         = orderedRecords.Select(w => w.Wfh).ToList();
        }