NceeCourseCombService.cs 1004 B

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