add basic versions of retrieving answers by question or completion
This commit is contained in:
parent
637e6c9824
commit
d73e0a104f
7 changed files with 95 additions and 16 deletions
|
|
@ -0,0 +1,40 @@
|
|||
using SurveyLib.Core.Models;
|
||||
using SurveyLib.Core.Repositories;
|
||||
using SurveyLib.Core.Services;
|
||||
|
||||
namespace SurveyBackend.Services.Services;
|
||||
|
||||
public class AnswerService : IAnswerService
|
||||
{
|
||||
private readonly IAnswerRepository _answerRepository;
|
||||
|
||||
public AnswerService(IAnswerRepository answerRepository)
|
||||
{
|
||||
_answerRepository = answerRepository;
|
||||
}
|
||||
|
||||
public async Task AddAnswerAsync(Answer answer)
|
||||
{
|
||||
await _answerRepository.AddAsync(answer);
|
||||
}
|
||||
|
||||
public async Task UpdateAnswerAsync(Answer answer)
|
||||
{
|
||||
await _answerRepository.UpdateAsync(answer);
|
||||
}
|
||||
|
||||
public async Task DeleteAnswerAsync(int id)
|
||||
{
|
||||
await _answerRepository.DeleteAsync(id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Answer>> GetAnswersByCompletionIdAsync(int completionId)
|
||||
{
|
||||
return await _answerRepository.GetAnswersByCompletionIdAsync(completionId);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Answer>> GetAnswersByQuestionIdAsync(int questionId)
|
||||
{
|
||||
return await _answerRepository.GetAnswersByQuestionIdAsync(questionId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue