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,21 +41,4 @@ public class SurveyRepository : ISurveyRepository
_context.Surveys.Remove(entity);
await _context.SaveChangesAsync();
}
public async Task<Survey?> GetWithQuestionsAsync(int surveyId)
{
return await _context.Surveys.Include(survey => survey.Questions)
.FirstOrDefaultAsync(s => s.Id == surveyId);
}
public async Task<Survey?> GetWithCompletionsAsync(int surveyId)
{
return await _context.Surveys.Include(survey => survey.Completions)
.FirstOrDefaultAsync(s => s.Id == surveyId);
}
public async Task<IEnumerable<Survey>> FindByTitleAsync(string title)
{
return await _context.Surveys.Where(s => s.Title.ToLower().Contains(title.ToLower())).ToListAsync();
}
}