Example #1
0
        private AnnualPlanClassGameModel GetClassAnnualPlanModel(GameHuntPlanDto classHuntPlanDto)
        {
            var annualPlanClassGameModel = new AnnualPlanClassGameModel
            {
                Class     = classHuntPlanDto.Class,
                ClassName = GameClassXRefs.FirstOrDefault(x => x.Id == classHuntPlanDto.Class).ClassName
            };

            annualPlanClassGameModel = SetPlans(annualPlanClassGameModel, new List <int> {
                classHuntPlanDto.GameId
            }, classHuntPlanDto.Class);

            return(annualPlanClassGameModel);
        }
Example #2
0
        private AnnualPlanSubKindGameModel GetSubKindAnnualPlanModel(int?gameKind, IGrouping <int?, GameDto> gameBySubKind)
        {
            if (!gameBySubKind.Key.HasValue)
            {
                return(new AnnualPlanSubKindGameModel());
            }

            List <GameHuntPlanDto> classHuntPlans = (from game in Games
                                                     join currentHuntPlan in CurrentHuntPlans on game.Id equals currentHuntPlan.GameId
                                                     where game.Kind == gameKind && game.SubKind == gameBySubKind.Key && currentHuntPlan.Class != null
                                                     select currentHuntPlan).ToList();

            var annualPlanClassGameModels = new List <AnnualPlanClassGameModel>();

            foreach (GameHuntPlanDto classHuntPlan in classHuntPlans)
            {
                AnnualPlanClassGameModel annualPlanClassGameModel = GetClassAnnualPlanModel(classHuntPlan);

                annualPlanClassGameModels.Add(annualPlanClassGameModel);
            }

            var annualPlanKindGameModel = new AnnualPlanSubKindGameModel
            {
                Type        = (GameType)GameType,
                SubKind     = gameBySubKind.Key,
                SubKindName = GamesByType.FirstOrDefault(x => x.Kind == gameKind && x.SubKind == gameBySubKind.Key).SubKindName,
                AnnualPlanClassGameModels = annualPlanClassGameModels
            };

            int gameId = GamesByType.FirstOrDefault(x => x.Kind == gameKind && x.SubKind == gameBySubKind.Key).Id;

            annualPlanKindGameModel = SetPlans(annualPlanKindGameModel, new List <int> {
                gameId
            });

            return(annualPlanKindGameModel);
        }