public Choice CreateChoice(ChoiceCreationDTO choiceCreation) { var choice = new Choice() { Name = choiceCreation.OptionName, Description = choiceCreation.OptionDescription, Poll = _pollRepos.Get(_pollRepos.GetPolls().FirstOrDefault(p => p.Id == choiceCreation.pollId).Name) }; _pollRepos.GetChoices(choiceCreation.pollId).Add(choice); _pollRepos.CreateChoice(choice, choiceCreation.pollId); return(choice); }
public Choice CreateChoice(string name, string desc, int pollId) { var choice = new Choice() { Name = name, Description = desc, Poll = GetPoll(_pollRepos.GetPolls().FirstOrDefault(p => p.Id == pollId).Name) }; //choice.Poll = _pollRepos.Get(pollId); _pollRepos.GetChoices(pollId).Add(choice); _pollRepos.CreateChoice(choice, pollId); return(choice); }