Exemple #1
0
        public async Task SetActiveRound(Guid roundId)
        {
            var activeRound = await _gameRoundRepository.GetActive();

            if (activeRound != null)
            {
                if (activeRound.State != GameRoundState.Archived)
                {
                    throw new Exception("Уже имеется активный раунд");
                }
                await _gameRoundRepository.Delete(activeRound.Id);

                await _gameDataRepository.Clear();
            }
            var round = await _gameRoundRepository.Get(roundId);

            round.State = GameRoundState.Active;
            await _gameRoundRepository.Update(round);
        }