コード例 #1
0
 private StatsViewModel GetCurrentSeasonStatsViewModel(User user, Team team)
 {
     var vm = new StatsViewModel();
       var skillLevel = user.SkillLevels.Where(sl => sl.GameType == team.Division.Season.GameType).FirstOrDefault();
       if (null != skillLevel) {
     vm.SkillLevel = skillLevel.Value;
       }
       vm.TeamId = team.Id;
       vm.TeamName = team.Name;
       var teammate = team.Players.Where(p => p != user).Single();
       vm.TeammateName = teammate.FullName;
       vm.TeammateId = teammate.Id;
       var winsAndLosses = team.GetWinsAndLossesForPlayer(user);
       vm.PersonalRecord = GetRecordText(winsAndLosses[0], winsAndLosses[1]);
       winsAndLosses = team.GetWinsAndLosses();
       vm.TeamRecord = GetRecordText(winsAndLosses[0], winsAndLosses[1]);
       return vm;
 }