示例#1
0
 protected bool Chosen(QuizProposal OneProposal)
 {
     if (UserChoices.TryGetValue(OneProposal.QuizItemId, out int proposalId))
     {
         // User already responded to this question
         // The choosen proposal of the user is proposalId
         // The correct proposal is OneProposal.Id
         return(OneProposal.Id == proposalId);
     }
     return(false);
 }
示例#2
0
        protected void ProposalClicked(QuizProposal OneProposal)
        {
            // Check if user already selected a proposal
            var found = UserChoices.ContainsKey(OneProposal.QuizItemId);

            // Remove previously selected proposal (if any)
            if (found)
            {
                UserChoices.Remove(OneProposal.QuizItemId);
            }
            // Add current selected proposal of the user
            UserChoices.Add(OneProposal.QuizItemId, OneProposal.Id);
        }