survey-webapp/SurveyBackend/SurveyBackend.Services/Services/CompletionService.cs

40 lines
No EOL
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using SurveyLib.Core.Models;
using SurveyLib.Core.Repositories;
using SurveyLib.Core.Services;
namespace SurveyBackend.Services.Services;
public class CompletionService : ICompletionService
{
private readonly ICompletionRepository _completionRepository;
public CompletionService(ICompletionRepository completionRepository)
{
_completionRepository = completionRepository;
}
public async Task AddCompletionAsync(Completion completion)
{
// TODO: проверить существование опроса
await _completionRepository.AddAsync(completion);
}
public async Task UpdateCompletionAsync(Completion completion)
{
// TODO: лол а что вообще значит ОбновитьВыполнение, надо выпилить из SurveyLib
await _completionRepository.UpdateAsync(completion);
}
public async Task DeleteCompletionAsync(int id)
{
// TODO: да и удалять их как-то бессмысленно
await _completionRepository.DeleteAsync(id);
}
public async Task<IEnumerable<Completion>> GetCompletionsBySurveyIdAsync(int surveyId)
{
// TODO: проверить существование опроса
// TODO: проверить что запрашивает создатель (хз как)
return await _completionRepository.GetCompletionsBySurveyIdAsync(surveyId);
}
}