1234567891011121314151617181920212223242526272829303132333435 |
- using YBEE.EQM.Core;
- namespace YBEE.EQM.Application;
- /// <summary>
- /// 高中选科组合管理服务
- /// </summary>
- public class CourseCombService : ICourseCombService, ITransient
- {
- private readonly IRepository<CourseComb> _rep;
- public CourseCombService(IRepository<CourseComb> rep)
- {
- _rep = rep;
- }
- /// <summary>
- /// 根据ID获取高中选科组合
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public async Task<CourseCombOutput> GetById(short id)
- {
- var item = await _rep.DetachedEntities.FirstOrDefaultAsync(x => x.Id == id);
- return item.Adapt<CourseCombOutput>();
- }
- /// <summary>
- /// 获取所有高中选科组合
- /// </summary>
- /// <returns></returns>
- public async Task<List<CourseCombOutput>> GetAllList()
- {
- var items = await _rep.DetachedEntities.ProjectToType<CourseCombOutput>().ToListAsync();
- return items;
- }
- }
|