public Base(CurrentPlayer currentPlayer, PlayerNames names, Places places, Purses purses, PenaltyBox penaltyBox, Categories categories, QuestionsByCategory questions, bool[] isGettingOutOfPenaltyBox) { this.currentPlayer = currentPlayer; this.names = names; this.places = places; this.purses = purses; this.penaltyBox = penaltyBox; this.categories = categories; this.questions = questions; this.isGettingOutOfPenaltyBox = isGettingOutOfPenaltyBox; }
public PenaltyBoxRollFactory(CurrentPlayer currentPlayer, PlayerNames names, Places places, Purses purses, PenaltyBox penaltyBox, Categories categories, QuestionsByCategory questions, bool[] isGettingOutOfPenaltyBox, int roll) : base(currentPlayer, names, places, purses, penaltyBox, categories, questions, isGettingOutOfPenaltyBox) { this.roll = roll; }
public async Task <ActiveCardModel> GetActiveCardId(int userId) { var activeSeason = await _seasonsQueryProcessor.GetActiveSeason(); var model = new ActiveCardModel(); var userCard = _uow.Query <UserCard>() .Include(x => x.Card) .ThenInclude(x => x.CardQuestions) .ThenInclude(x => x.Question) .ThenInclude(x => x.Category) .Include(x => x.UserSeasonLeague) .Where(x => x.UserSeasonLeague.SeasonId == activeSeason.Id) .Include(x => x.UserAnswers) .Where(x => x.UserSeasonLeague.UserId == userId && x.CardStateId == CardStates.ACTIVE) .SingleOrDefault(); if (userCard == null) { throw new NotFoundException("no active card for this user !"); } model.CardId = userCard.CardId; model.QuestionsByCategoryList = new List <QuestionsByCategory>(); for (int i = 1; i <= 10; i++) { QuestionsByCategory q = new QuestionsByCategory(); q.CategoryId = (from c in _uow.Query <Category>() where c.Sort == i select c ).SingleOrDefault().Id; q.CategoryName = (from c in _uow.Query <Category>() where c.Sort == i select c ).SingleOrDefault().Name; q.QuestionId = userCard.Card.CardQuestions.Select(x => x.Question).Where(c => c.Category.Sort == i).SingleOrDefault().Id; if (userCard.UserAnswers.Where(c => c.Question.Category.Sort == i).Any()) { q.IsAnswered = true; } else { q.IsAnswered = false; } q.Sort = i; model.QuestionsByCategoryList.Add(q); } model.CardScoreList = new List <CardScore>(); for (int i = 1; i <= 10; i++) { CardScore score = new CardScore(); if (userCard.UserAnswers.Where(c => c.Sort == i).Any()) { score.Sort = i; score.Score = userCard.UserAnswers.Where(c => c.Sort == i).SingleOrDefault().AnswerPoints; } else { score.Sort = i; score.Score = null; } model.CardScoreList.Add(score); } return(model); }
public CorrectFactory(CurrentPlayer currentPlayer, PlayerNames names, Places places, Purses purses, PenaltyBox penaltyBox, Categories categories, QuestionsByCategory questions, bool[] isGettingOutOfPenaltyBox) : base(currentPlayer, names, places, purses, penaltyBox, categories, questions, isGettingOutOfPenaltyBox) { }