CourseCombService.cs 968 B

1234567891011121314151617181920212223242526272829303132333435
  1. using YBEE.EQM.Core;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 高中选科组合管理服务
  5. /// </summary>
  6. public class CourseCombService : ICourseCombService, ITransient
  7. {
  8. private readonly IRepository<CourseComb> _rep;
  9. public CourseCombService(IRepository<CourseComb> rep)
  10. {
  11. _rep = rep;
  12. }
  13. /// <summary>
  14. /// 根据ID获取高中选科组合
  15. /// </summary>
  16. /// <param name="id"></param>
  17. /// <returns></returns>
  18. public async Task<CourseCombOutput> GetById(short id)
  19. {
  20. var item = await _rep.DetachedEntities.FirstOrDefaultAsync(x => x.Id == id);
  21. return item.Adapt<CourseCombOutput>();
  22. }
  23. /// <summary>
  24. /// 获取所有高中选科组合
  25. /// </summary>
  26. /// <returns></returns>
  27. public async Task<List<CourseCombOutput>> GetAllList()
  28. {
  29. var items = await _rep.DetachedEntities.ProjectToType<CourseCombOutput>().ToListAsync();
  30. return items;
  31. }
  32. }