Esempio n. 1
0
        /// <summary>
        /// Gets the scrutin.
        /// </summary>
        /// <param name="scrutinId">The scrutin identifier.</param>
        /// <returns></returns>
        /// <exception cref="VoteIn.BL.Exceptions.VoteInException">Le scrutin n'existe pas</exception>
        private VotingProcess GetScrutin(int scrutinId)
        {
            var scrutin = VotingProcessRepository.GetVotingProcess()
                          .Include(s => s.VotingProcessMode.Choice)
                          .Include(s => s.VotingProcessOption).ThenInclude(o => o.Option)
                          .Include(s => s.VotingProcessOption).ThenInclude(o => o.Act)
                          .Include(s => s.Suffrage)
                          .Include(s => s.Envelope)
                          .FirstOrDefault(s => s.Id == scrutinId);

            if (scrutin == null)
            {
                throw new VoteInException("Le scrutin n'existe pas");
            }
            return(scrutin);
        }