private IEnumerable <DraftCardViewModel> GetUpdatedDraftCards(TeamViewModel teamVm)
        {
            if (CurrentPick == null)
            {
                return(null);
            }

            return(DraftRounds.Where(round => round.RoundNumber < CurrentPick.RoundNumber).Select(round => round.DraftPicks.Where(pick => pick.Player != null).SingleOrDefault(x => x.PickNumber == teamVm.DraftOrder)));
        }
        private void InitializeDraftRounds()
        {
            DraftRounds.Clear();

            int numberOfRounds = league.Teams.Max(x => x.DraftCards.Count());

            for (int i = 1; i <= numberOfRounds; i++)
            {
                var draftRound = new PlayerDraftRoundViewModel(core, league, i);

                DraftRounds.Add(draftRound);
            }
        }
        private void ProcessNextPick()
        {
            if (CurrentPick == null)
            {
                var firstRound = DraftRounds.First();

                CurrentPick = firstRound.DraftPicks.OrderBy(x => x.PickNumber).First();
            }

            if (CurrentPick.Player != null)
            {
                var nextPick = GetNextPick();

                CurrentPick = nextPick;
            }

            NotifyPropertyChanged("DraftPanel");
            NotifyPropertyChanged("CanDraftPlayer");
            NotifyPropertyChanged("CanGoToNextPick");
        }
        private DraftCardViewModel GetNextPick()
        {
            var currentRoundNumber = CurrentPick.RoundNumber;
            var currentRound       = DraftRounds.ElementAtOrDefault(currentRoundNumber - 1);

            var nextPickNumber = CurrentPick.PickNumber + 1;

            if (currentRound.DraftPicks.Count < nextPickNumber)
            {
                currentRound   = DraftRounds.ElementAtOrDefault(currentRoundNumber);
                nextPickNumber = 1;
            }

            if (currentRound == null)
            {
                IsDone = true;
                return(null);
            }

            return(currentRound.DraftPicks.OrderBy(x => x.PickNumber).ElementAtOrDefault(nextPickNumber - 1));
        }