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);
        }
示例#2
0
 public Poll Get(Guid id)
 {
     return(_pollRepository.Get(id));
 }
示例#3
0
 public List <Choice> GetChoices(string pollName)
 {
     return(_pollRepos.GetChoices(_pollRepos.Get(pollName).Id));
 }
示例#4
0
        public Dictionary <string, int> GetPollResult(string pollName)
        {
            int pollId = _pollRepos.Get(pollName).Id;

            return(_voteRepos.GetResultInPoll(pollId));
        }