/// <summary>
        /// Обновляет индексы на группах данного квеста
        /// </summary>
        /// <param name="questId">ID Квеста</param>
        private void UpdateIndexes(Guid questId)
        {
            var questionGroups = _QuestionGroupRepository.RetrieveMultiple(g => g.QuestId == questId);

            for (var i = 0; i < questionGroups.Count; i++)
            {
                questionGroups[i].Index = i + 1;
                _QuestionGroupRepository.Update(questionGroups[i]);
            }
        }
Example #2
0
        private void FinishQuest(Guid teamId)
        {
            var team = _TeamRepository.Retrieve(teamId);

            if (!team.HasFinished || !team.FinishDate.HasValue)
            {
                var groups = _QuestionGroupRepository.RetrieveMultiple(gr => gr.QuestId == team.QuestId);
                foreach (var group in groups)
                {
                    FinishGroup(group.Id);
                }

                team.HasFinished = true;
                team.FinishDate  = DateTime.UtcNow;
                _TeamRepository.Update(team);
            }
        }