SemesterAppService.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using YBEE.EQM.Core;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 学期信息管理服务
  5. /// </summary>
  6. [ApiDescriptionSettings(Name = "base-semester")]
  7. [Route("base/semester")]
  8. public class SemesterAppService : IDynamicApiController
  9. {
  10. private readonly ISemesterService _semesterService;
  11. public SemesterAppService(ISemesterService semesterService)
  12. {
  13. _semesterService = semesterService;
  14. }
  15. /// <summary>
  16. /// 添加学期
  17. /// </summary>
  18. /// <returns></returns>
  19. public async Task Add()
  20. {
  21. await _semesterService.Add();
  22. }
  23. /// <summary>
  24. /// 设置当前学期
  25. /// </summary>
  26. /// <param name="input"></param>
  27. /// <returns></returns>
  28. public async Task SetCurrent(BaseId<short> input)
  29. {
  30. await _semesterService.SetCurrent(input);
  31. }
  32. /// <summary>
  33. /// 根据ID获取单个学期
  34. /// </summary>
  35. /// <param name="id"></param>
  36. /// <returns></returns>
  37. public async Task<SemesterOutput> GetById([FromQuery][Required] int id)
  38. {
  39. return await _semesterService.GetById(id);
  40. }
  41. /// <summary>
  42. /// 获取当前学期
  43. /// </summary>
  44. /// <returns></returns>
  45. public async Task<SemesterOutput> GetCurrent()
  46. {
  47. return await _semesterService.GetCurrent();
  48. }
  49. /// <summary>
  50. /// 获取全部学期信息列表
  51. /// </summary>
  52. /// <returns></returns>
  53. public async Task<List<SemesterOutput>> GetAllList()
  54. {
  55. return await _semesterService.GetAllList();
  56. }
  57. }