assigonmentDto

This commit is contained in:
SpecialX
2025-06-24 11:37:12 +08:00
parent 681c0862b6
commit 0ee411bf50
11 changed files with 260 additions and 214 deletions

View File

@@ -75,10 +75,11 @@ namespace TechHelper.Server.Services
return _mapper.Map<AssignmentDto>(assignment);
}
public async Task<IEnumerable<AssignmentDto>> GetAllExamPreviewsAsync(Guid userId)
public async Task<ApiResponse> GetAllExamPreviewsAsync(Guid userId)
{
var assignments = await _examRepository.GetExamPreviewsByUserAsync(userId);
return _mapper.Map<IEnumerable<AssignmentDto>>(assignments);
var result = _mapper.Map<List<AssignmentDto>>(assignments);
return ApiResponse.Success(result: result);
}
@@ -87,9 +88,15 @@ namespace TechHelper.Server.Services
throw new NotImplementedException();
}
public Task<ApiResponse> GetAsync(Guid id)
public async Task<ApiResponse> GetAsync(Guid id)
{
throw new NotImplementedException();
var assignment = await _examRepository.GetFullExamByIdAsync(id);
if (assignment == null)
{
return ApiResponse.Error("获取失败");
}
var result = _mapper.Map<AssignmentDto>(assignment);
return ApiResponse.Success(result: result);
}
public Task<ApiResponse> AddAsync(AssignmentDto model)
@@ -107,10 +114,6 @@ namespace TechHelper.Server.Services
throw new NotImplementedException();
}
Task<ApiResponse> IExamService.GetAllExamPreviewsAsync(Guid userId)
{
throw new NotImplementedException();
}
}
}