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); }
public async Task <QuestionType> GetQuestionTypeAsync(QuestionTypeAnswer Answer) { return(await GetQuestionTypesQueryWithAnswers() .FirstOrDefaultAsync(x => x.Answers.Contains(Answer))); }