示例#1
0
        public static RecordViewModel Build(Record record)
        {
            var viewModel = new RecordViewModel();

            var witnessList = record.Witnesses.Select(obj => obj.Competitor).ToList();

            viewModel.RecordId     = record.Id;
            viewModel.Competitor   = CompetitorViewModel.Build(record.Competitor);
            viewModel.Event        = EventViewModel.Build(record.OlympicEvent);
            viewModel.Score        = ScoreViewModel.Build(record.Score, record.OlympicEvent.EventTypeId);
            viewModel.DateAchieved = record.DateAchieved;
            viewModel.Witness1     = CompetitorViewModel.Build(witnessList[0]);
            viewModel.Witness2     = CompetitorViewModel.Build(witnessList[1]);

            return(viewModel);
        }