Esempio n. 1
0
        public ChoiceCreationDTO CreateChoiceConsole()
        {
            ChoiceCreationDTO choiceCreation = new ChoiceCreationDTO();

            Console.WriteLine("Enter PollName to add an option:");
            string pollName1      = Console.ReadLine();
            Poll   poll           = _pollRepos.Get(pollName1);
            bool   policyresponse = _policyChecker.CheckAdminPolicy(poll.Id);

            if (policyresponse == false)
            {
                Console.WriteLine("You have no rights to create options for this poll!");
                Console.ReadLine();
                return(null);
            }
            Console.WriteLine("Enter Option Name: ");
            choiceCreation.OptionName = Console.ReadLine();
            Console.WriteLine("Enter option description: ");
            choiceCreation.OptionDescription = Console.ReadLine();
            choiceCreation.pollId            = poll.Id;
            return(choiceCreation);
        }
Esempio n. 2
0
 public Poll Get(Guid id)
 {
     return(_pollRepository.Get(id));
 }
Esempio n. 3
0
 public List <Choice> GetChoices(string pollName)
 {
     return(_pollRepos.GetChoices(_pollRepos.Get(pollName).Id));
 }
Esempio n. 4
0
        public Dictionary <string, int> GetPollResult(string pollName)
        {
            int pollId = _pollRepos.Get(pollName).Id;

            return(_voteRepos.GetResultInPoll(pollId));
        }