예제 #1
0
        public async Task <QuestionTypeAnswer> AddQuestionTypeAnswerAsync(string Answer, int TypeId)
        {
            var qtypeAnswer = await GetQuestionTypeAnswerAsync(Answer);

            if (qtypeAnswer == null)
            {
                qtypeAnswer = new QuestionTypeAnswer()
                {
                    TypeId    = TypeId,
                    Answer    = Answer,
                    PublicKey = Guid.NewGuid()
                };

                await context.QuestionTypeAnswers
                .AddAsync(qtypeAnswer);

                await context.SaveChangesAsync();
            }

            return(qtypeAnswer);
        }
예제 #2
0
 public async Task <QuestionType> GetQuestionTypeAsync(QuestionTypeAnswer Answer)
 {
     return(await GetQuestionTypesQueryWithAnswers()
            .FirstOrDefaultAsync(x => x.Answers.Contains(Answer)));
 }