adapt repository features to services needs
This commit is contained in:
parent
3961dbeb69
commit
9f6d5b575e
4 changed files with 18 additions and 1 deletions
|
|
@ -47,4 +47,14 @@ public class AnswerRepository : IAnswerRepository
|
|||
.ExecuteDeleteAsync();
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Answer>> GetAnswersByCompletionIdAsync(int completionId)
|
||||
{
|
||||
return await _context.Answers.Where(a => a.CompletionId == completionId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Answer>> GetAnswersByQuestionIdAsync(int questionId)
|
||||
{
|
||||
return await _context.Answers.Where(a => a.QuestionId == questionId).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
|
@ -41,4 +41,9 @@ public class CompletionRepository : ICompletionRepository
|
|||
await _context.Completions.Where(c => c.Id == id).ExecuteDeleteAsync();
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Completion>> GetCompletionsBySurveyIdAsync(int surveyId)
|
||||
{
|
||||
return await _context.Completions.Where(c => c.SurveyId == surveyId).ToListAsync();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue