Files
TechHelper/TechHelper.Server/Services/SubmissionServices.cs
SpecialX a21ca80782 1
2025-06-27 19:03:10 +08:00

92 lines
2.4 KiB
C#

using AutoMapper;
using Entities.Contracts;
using Microsoft.EntityFrameworkCore;
using SharedDATA.Api;
using TechHelper.Services;
namespace TechHelper.Server.Services
{
public class SubmissionServices : ISubmissionServices
{
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
private readonly IRepository<Submission> _submissionRepository;
private readonly IRepository<SubmissionDetail> _submissionDetailRepository;
public SubmissionServices(IMapper mapper, IUnitOfWork unitOfWork)
{
_mapper = mapper;
_unitOfWork = unitOfWork;
_submissionRepository = _unitOfWork.GetRepository<Submission>();
_submissionDetailRepository = _unitOfWork.GetRepository<SubmissionDetail>();
}
public Task<ApiResponse> AddAsync(Submission model)
{
throw new NotImplementedException();
}
public Task<ApiResponse> DeleteAsync(Guid id)
{
throw new NotImplementedException();
}
public Task<ApiResponse> GetAllAsync(QueryParameter query)
{
throw new NotImplementedException();
}
public async Task<ApiResponse> GetAllErrorQuestionsAsync(Guid userId)
{
try
{
var errorSDs = await _submissionDetailRepository.GetPagedListAsync(predicate: sd => sd.StudentId == userId && sd.IsCorrect == false,
include: i => i
.Include(s => s.AssignmentQuestion)
.ThenInclude(aq => aq.Question));
var errorQuestion = errorSDs.Items.Select(sd => sd.AssignmentQuestion).ToList();
return ApiResponse.Success();
}
catch (Exception ex)
{
return ApiResponse.Error();
}
}
public Task<ApiResponse> GetAllErrorQuestionTypeDisAsync(Guid assignmentId, Guid userId)
{
throw new NotImplementedException();
}
public Task<ApiResponse> GetAssignmentAllStudentsError(Guid assignmentId, Guid teacherId)
{
throw new NotImplementedException();
}
public Task<ApiResponse> GetAssignmentErrorQuestionsAsync(Guid assignmentId, Guid userId)
{
throw new NotImplementedException();
}
public Task<ApiResponse> GetAssignmentErrorQuestionTypeDisAsync(Guid assignmentId, Guid userId)
{
throw new NotImplementedException();
}
public Task<ApiResponse> GetAsync(Guid id)
{
throw new NotImplementedException();
}
public Task<ApiResponse> GetQuestionErrorStudents(Guid assignmentId)
{
throw new NotImplementedException();
}
public Task<ApiResponse> UpdateAsync(Submission model)
{
throw new NotImplementedException();
}
}
}