AdminSystemLabelController.cs 1.8 KB

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