AdminCommentController.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Threading.Tasks;
  2. using GxPress.Common.Page;
  3. using GxPress.Repository.Interface;
  4. using GxPress.Request.Comment;
  5. using GxPress.Result.Comment;
  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/comment")]
  14. [ApiController]
  15. public class AdminCommentController : ControllerBase
  16. {
  17. private readonly ICommentRepository _commentRepository;
  18. public AdminCommentController(ICommentRepository commentRepository)
  19. {
  20. _commentRepository = commentRepository;
  21. }
  22. /// <summary>
  23. /// 分页显示数据
  24. /// </summary>
  25. /// <param name="request"></param>
  26. /// <returns></returns>
  27. [HttpPost("page")]
  28. public async Task<PagedList<CommentPageResult>> GetPagedList([FromBody] CommentSearchPageRequest request)
  29. {
  30. return await _commentRepository.GetPagedList(request);
  31. }
  32. /// <summary>
  33. /// 删除
  34. /// </summary>
  35. /// <param name="request"></param>
  36. /// <returns></returns>
  37. [HttpDelete("delete")]
  38. [AllowAnonymous]
  39. public async Task<bool> Delete([FromBody] CommentDeleteRequest request)
  40. {
  41. return await _commentRepository.DeleteCommentAsync(request);
  42. }
  43. }
  44. }