WebOrderController.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Threading.Tasks;
  2. using GxPress.Auth;
  3. using GxPress.Common.Page;
  4. using GxPress.Repository.Interface.Order;
  5. using GxPress.Request.Order;
  6. using Microsoft.AspNetCore.Authorization;
  7. using Microsoft.AspNetCore.Mvc;
  8. namespace GxPress.Api.WebControllers
  9. {
  10. /// <summary>
  11. /// 导航
  12. /// </summary>
  13. [Route("api/web/order")]
  14. [ApiController]
  15. [Authorize]
  16. public class WebOrderController : Controller
  17. {
  18. private readonly IOrderRepository orderRepository;
  19. public readonly ILoginContext _loginContext;
  20. public WebOrderController(IOrderRepository orderRepository, ILoginContext _loginContext)
  21. {
  22. this.orderRepository = orderRepository;
  23. this._loginContext = _loginContext;
  24. }
  25. /// <summary>
  26. /// 查询订单
  27. /// </summary>
  28. /// <param name="request"></param>
  29. /// <returns></returns>
  30. [HttpPost("page")]
  31. public async Task<PagedList<Entity.Order.Order>> GetAllOrderAsync(OrderSearchRequest request)
  32. {
  33. request.UserId = _loginContext.AccountId;
  34. return await orderRepository.GetAllOrderAsync(request);
  35. }
  36. }
  37. }