Example #1
0
        public QuestionAdded Update(QuestionAdded result, VoteEnum newVote)                                                                                    //update votes counter on every new vote added to the list
        {
            var totalvotes = result.TotalVotes.ToList();                                                                                                       //get current list of votes

            totalvotes.Add(newVote);                                                                                                                           //add current vote to the list

            return(new QuestionAdded(result.Id, result.Title, result.Text, result.Tags, totalvotes.Sum(nrOfVotes => Convert.ToInt32(nrOfVotes)), totalvotes)); //update question data
        }
Example #2
0
        public void Add([NotNull] Question question)
        {
            if (_questions == null)
            {
                _questions = new List <Question>();
            }

            if (!_questions.Contains(question))
            {
                _questions.Add(question);
                QuestionAdded?.Invoke(question);
            }
        }