예제 #1
0
        public void AddPlayer(Player player, GolfRoundType golfRoundType, NineType?nineType)
        {
            var golfer = new Golfer()
            {
                Id      = Golfers.Count + 1,
                Name    = player.Name,
                IsAdmin = Golfers.Count == 0,
                Holes   = new List <Hole>()
            };

            if (golfRoundType == GolfRoundType.Eighteen || nineType == NineType.Front)
            {
                int iterator = 1;
                while (iterator <= (int)golfRoundType)
                {
                    golfer.Holes.Add(new Hole()
                    {
                        Id = iterator
                    });

                    iterator++;
                }
            }
            else
            {
                int iterator = 10;
                while (iterator <= 18)
                {
                    golfer.Holes.Add(new Hole()
                    {
                        Id = iterator
                    });

                    iterator++;
                }
            }

            Golfers.Add(golfer);
        }
예제 #2
0
 public GolferScoreView(Golfer golfer)
 {
     Name       = golfer.Name;
     TotalDots  = golfer.Holes.Sum(h => h.Dots.Count);
     RoundScore = golfer.Holes.Sum(h => h.Score);
 }