AdminMiddleLableController.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Repository.Interface.Navigation;
  4. using Microsoft.AspNetCore.Authorization;
  5. using Microsoft.AspNetCore.Mvc;
  6. namespace GxPress.Api.AdminControllers
  7. {
  8. /// <summary>
  9. /// 导航中间件
  10. /// </summary>
  11. [Route("api/admin/middle-label")]
  12. [ApiController]
  13. [Authorize]
  14. public class AdminMiddleLableController : ControllerBase
  15. {
  16. private readonly IMiddleLableRepository middleLableRepository;
  17. public AdminMiddleLableController(IMiddleLableRepository middleLableRepository)
  18. {
  19. this.middleLableRepository = middleLableRepository;
  20. }
  21. /// <summary>
  22. /// 列表
  23. /// </summary>
  24. /// <returns></returns>
  25. [HttpGet]
  26. public async Task<IEnumerable<Entity.Navigations.MiddleLable>> GetList()
  27. {
  28. return await middleLableRepository.GetAllAsync();
  29. }
  30. /// <summary>
  31. /// 详情
  32. /// </summary>
  33. /// <param name="id"></param>
  34. /// <returns></returns>
  35. [HttpGet("{id}")]
  36. public async Task<Entity.Navigations.MiddleLable> GetAsync(int id)
  37. {
  38. return await middleLableRepository.GetAsync(id);
  39. }
  40. /// <summary>
  41. /// 添加导航中间件
  42. /// </summary>
  43. /// /// <param name="note"></param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public async Task<int> Insert(Entity.Navigations.MiddleLable note)
  47. {
  48. return await middleLableRepository.InsertAsync(note);
  49. }
  50. /// <summary>
  51. /// 修改导航中间件
  52. /// </summary>
  53. /// <param name="note"></param>
  54. /// <returns></returns>
  55. [HttpPut]
  56. public async Task<bool> Update(Entity.Navigations.MiddleLable note)
  57. {
  58. return await middleLableRepository.UpdateAsync(note);
  59. }
  60. }
  61. }