示例#1
0
        public async Task <InGameAnswer> PostQuoteAnswerAsync(int userId, InGameQuote quote)
        {
            var res = (await _quotesRepo.GetQuoteAuthorAsync(quote.Id)).ToInGameAnswer();

            bool isRightAnswer = quote.AnswersCount == 1 //Is YesNo question
                ? (res.AuthorId == quote.Answers[0].AuthorId) == (quote.AnsweredAuthorId != null)
                : res.AuthorId == quote.AnsweredAuthorId;

            await _answeredQuotesRepo.AddAsync(quote.ToUserAnsweredQuote(userId, isRightAnswer));

            return(res);
        }