BolfTracker.Web.LeaderboardViewModel.LeaderboardViewModel C# (CSharp) Method

LeaderboardViewModel() public method

public LeaderboardViewModel ( BolfTracker.Models.Player player, IEnumerable playerShots, BolfTracker.Models.Game game, IEnumerable shots ) : System
player BolfTracker.Models.Player
playerShots IEnumerable
game BolfTracker.Models.Game
shots IEnumerable
return System
        public LeaderboardViewModel(Player player, IEnumerable<Shot> playerShots, Game game, IEnumerable<Shot> shots)
        {
            Player = player;
            Points = playerShots.Where(s => s.ShotType.Id != ShotTypePush).Sum(s => s.Points);
            ShotsMade = playerShots.Count(s => s.ShotMade);
            Attempts = playerShots.Sum(s => s.Attempts);
            ShootingPercentage = Decimal.Round(Convert.ToDecimal(ShotsMade) / Convert.ToDecimal(Attempts), 2, MidpointRounding.AwayFromZero);
            Steals = shots.Count(s => s.Player.Id == player.Id && (s.ShotType.Id == 4 || s.ShotType.Id == 5));
            Pushes = shots.Count(s => s.Player.Id == player.Id && s.ShotType.Id == 3);
        }
LeaderboardViewModel