Merge branch 'features/add-service-interfaces' into 'unstable'

Add service interfaces to Core

See merge request internship-2025/survey-webapp/surveylib!5
This commit is contained in:
Вячеслав 2025-04-01 11:53:26 +00:00
commit 28a1b1d23a
4 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,12 @@
using SurveyLib.Core.Models;
namespace SurveyLib.Core.Services;
public interface IAnswerService
{
Task<bool> AddAnswerAsync(Answer answer);
Task<bool> UpdateAnswerAsync(Answer answer);
Task<bool> DeleteAnswerAsync(int id);
Task<IEnumerable<Answer>> GetAnswersByCompletionIdAsync(int completionId);
Task<IEnumerable<Answer>> GetAnswersByQuestionIdAsync(int questionId);
}

View file

@ -0,0 +1,11 @@
using SurveyLib.Core.Models;
namespace SurveyLib.Core.Services;
public interface ICompletionService
{
Task<bool> AddCompletionAsync(Completion completion);
Task<bool> UpdateCompletionAsync(Completion completion);
Task<bool> DeleteCompletionAsync(int id);
Task<IEnumerable<Completion>> GetCompletionsBySurveyIdAsync(int surveyId);
}

View file

@ -0,0 +1,11 @@
using SurveyLib.Core.Models;
namespace SurveyLib.Core.Services;
public interface IQuestionService
{
Task<bool> AddQuestionAsync(QuestionBase question);
Task<bool> UpdateQuestionAsync(QuestionBase question);
Task<bool> DeleteQuestionAsync(int id);
Task<IEnumerable<QuestionBase>> GetQuestionsBySurveyIdAsync(int surveyId);
}

View file

@ -0,0 +1,14 @@
using SurveyLib.Core.Models;
namespace SurveyLib.Core.Services;
public interface ISurveyService
{
Task<bool> AddSurveyAsync(Survey survey);
Task<bool> UpdateSurveyAsync(Survey survey);
Task<bool> DeleteSurveyAsync(int id);
Task<IEnumerable<Survey>> GetSurveysAsync();
Task<Survey> GetSurveyByIdAsync(int id);
Task<Survey> GetSurveyWithQuestionsByIdAsync(int id);
Task<Survey> GetSurveyWithAnswersByIdAsync(int id);
}