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); }
public Poll Get(Guid id) { return(_pollRepository.Get(id)); }
public List <Choice> GetChoices(string pollName) { return(_pollRepos.GetChoices(_pollRepos.Get(pollName).Id)); }
public Dictionary <string, int> GetPollResult(string pollName) { int pollId = _pollRepos.Get(pollName).Id; return(_voteRepos.GetResultInPoll(pollId)); }