AdminGroupController.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections.Generic;
  2. using System.Threading.Tasks;
  3. using GxPress.Repository.Interface;
  4. using GxPress.Request.App.Group;
  5. using GxPress.Result.App.Group;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. namespace GxPress.Api.AdminControllers
  9. {
  10. [Route("api/admin/group")]
  11. [ApiController]
  12. [Authorize]
  13. public class AdminGroupController : Controller
  14. {
  15. private readonly IGroupRepository groupRepository;
  16. public AdminGroupController(IGroupRepository groupRepository)
  17. {
  18. this.groupRepository = groupRepository;
  19. }
  20. /// <summary>
  21. /// 获取小组列表
  22. /// </summary>
  23. /// <returns></returns>
  24. [HttpGet("list")]
  25. public async Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults([FromQuery]string keyWord)
  26. {
  27. return await groupRepository.GetGroupDetailResults(keyWord);
  28. }
  29. /// <summary>
  30. /// 修改小组
  31. /// </summary>
  32. /// <param name="request"></param>
  33. /// <returns></returns>
  34. [HttpPost("update")]
  35. public async Task<bool> Update(GroupUpRequest request)
  36. {
  37. return await groupRepository.UpdateAsync(request);
  38. }
  39. }
  40. }