public async Task AddComment(string questionId, Comment comment)
        {
            var question = await _store.GetQuestion(questionId);

            if (question != null)
            {
                if (question.Comments == null)
                {
                    question.Comments = new List <Comment>();
                }
                comment.id = Guid.NewGuid().ToString();
                question.Comments.Add(comment);
                await _store.UpdateQuestion(questionId, question);
            }
        }
        public async Task <bool> AddAnswer(string questionid, Answer answer)
        {
            var question = await _store.GetQuestion(questionid);

            if (question != null)
            {
                if (question.Answers == null)
                {
                    answer.Id        = Guid.NewGuid().ToString();
                    question.Answers = new List <Answer>();
                }
                question.Answers.Add(answer);
                await _store.UpdateQuestion(questionid, question);

                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public async Task AddBounty(string questionId, int bounty)
        {
            var question = await _store.GetQuestion(questionId);

            if (question != null)
            {
                question.Bounty = bounty;
                await _store.UpdateQuestion(questionId, question);
            }
        }