AdminSystemLabelController.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Common.Page;
  4. using GxPress.Repository.Interface.SystemLabel;
  5. using GxPress.Request.SystemLabel;
  6. using GxPress.Result.SystemLabel;
  7. using GxPress.Service.Interface.SystemLabel;
  8. using Microsoft.AspNetCore.Authorization;
  9. using Microsoft.AspNetCore.Mvc;
  10. namespace GxPress.Api.AdminControllers
  11. {
  12. /// <summary>
  13. /// 系统标签管理
  14. /// </summary>
  15. [Route("api/admin/system-label")]
  16. [ApiController]
  17. [Authorize]
  18. public class AdminSystemLabelController : ControllerBase
  19. {
  20. private readonly ISystemLabelRepository _repository;
  21. private readonly ISystemLableMediaRepository systemLableMediaRepository;
  22. private readonly ISystemLabelService systemLabelService;
  23. public AdminSystemLabelController(ISystemLabelRepository repository, ISystemLabelService systemLabelService, ISystemLableMediaRepository systemLableMediaRepository)
  24. {
  25. _repository = repository;
  26. this.systemLabelService = systemLabelService;
  27. this.systemLableMediaRepository = systemLableMediaRepository;
  28. }
  29. /// <summary>
  30. /// 添加
  31. /// </summary>
  32. /// <param name="note"></param>
  33. /// <returns></returns>
  34. [HttpPost]
  35. public async Task<int> Insert(Entity.SystemLabel.SystemLabel note)
  36. {
  37. return await _repository.InsertAsync(note);
  38. }
  39. /// <summary>
  40. /// 修改
  41. /// </summary>
  42. /// <param name="request"></param>
  43. /// <returns></returns>
  44. [HttpPut]
  45. public async Task<bool> UpdateAsync(SystemLabelUpRequest request)
  46. {
  47. return await _repository.UpdateAsync(request);
  48. }
  49. /// <summary>
  50. /// 获取标签列表
  51. /// </summary>
  52. /// <returns></returns>
  53. [HttpPost("list")]
  54. public async Task<PagedList<SystemLabelResult>> GetAllAsync(Common.Page.PageParameter pageParameter)
  55. {
  56. return await systemLabelService.GetAllAsync(pageParameter);
  57. }
  58. /// <summary>
  59. /// 删除
  60. /// </summary>
  61. /// <param name="id"></param>
  62. /// <returns></returns>
  63. [HttpDelete("{id}")]
  64. public async Task<bool> DeleteAsync(int id)
  65. {
  66. return await _repository.DeleteAsync(id);
  67. }
  68. /// <summary>
  69. /// 添加标签媒体
  70. /// </summary>
  71. /// <param name="request"></param>
  72. /// <returns></returns>
  73. [HttpPost("add")]
  74. public async Task<bool> InsertAsync(SystemLableMediaRequest request)
  75. {
  76. return await systemLableMediaRepository.InsertAsync(request);
  77. }
  78. }
  79. }