AdminNavigationController.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Repository.Interface.Navigation;
  4. using GxPress.Request.Navigation;
  5. using GxPress.Result.Navigation;
  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/navigation")]
  14. [ApiController]
  15. [Authorize]
  16. public class AdminNavigationController : ControllerBase
  17. {
  18. private readonly INavigationRepository navigationRepository;
  19. public AdminNavigationController(INavigationRepository navigationRepository)
  20. {
  21. this.navigationRepository = navigationRepository;
  22. }
  23. /// <summary>
  24. /// 列表 pc 1 移动 2
  25. /// </summary>
  26. /// <returns></returns>
  27. [HttpGet("{terminal}")]
  28. public async Task<IEnumerable<NavigationResult>> GetList(int terminal)
  29. {
  30. return await navigationRepository.GetAllAsync(terminal);
  31. }
  32. /// <summary>
  33. /// 添加导航
  34. /// </summary>
  35. /// /// <param name="note"></param>
  36. /// <returns></returns>
  37. [HttpPost]
  38. public async Task<int> Insert(Entity.Navigations.Navigation note)
  39. {
  40. return await navigationRepository.InsertAsync(note);
  41. }
  42. /// <summary>
  43. /// 修改导航
  44. /// </summary>
  45. /// <param name="request"></param>
  46. /// <returns></returns>
  47. [HttpPut]
  48. public async Task<bool> Update(NavigationUpRequest request)
  49. {
  50. return await navigationRepository.UpdateAsync(request);
  51. }
  52. }
  53. }