using System.Linq; using System.Threading.Tasks; using GxPress.Common.Page; using GxPress.Entity; using GxPress.Repository.Interface; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AppControllers { /// /// 审批轮播 /// [Route("api/app/slide")] [ApiController] [Authorize] public class SlideController : ControllerBase { private readonly ISlideRepository _slideRepository; public SlideController(ISlideRepository slideRepository) { _slideRepository = slideRepository; } /// /// App列表 /// /// [HttpGet("list")] public async Task> GetList() { var pagedList =new PagedList(); var result = await _slideRepository.GetListAsync(); var pagedListItems = result as Slide[] ?? result.ToArray(); pagedList.Items = pagedListItems; pagedList.Total = pagedListItems.Count(); return pagedList; } } }