overthinking repositories from scratch

This commit is contained in:
Вячеслав 2025-04-16 17:32:24 +05:00
parent 58271df949
commit 845db13c63
8 changed files with 4 additions and 51 deletions

View file

@ -41,15 +41,4 @@ public class QuestionRepository : IQuestionRepository
_context.Questions.Remove(entity);
await _context.SaveChangesAsync();
}
public async Task<QuestionBase?> GetWithAnswersAsync(int questionId)
{
return await _context.Questions.Include(q => q.Answers)
.FirstOrDefaultAsync(q => q.Id == questionId);
}
public async Task<IEnumerable<QuestionBase>> GetBySurveyIdAsync(int surveyId)
{
return await _context.Questions.Where(q => q.SurveyId == surveyId).ToListAsync();
}
}