using System.Collections.Generic;
using System.Threading.Tasks;
using GxPress.Entity;
using GxPress.Repository.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace GxPress.Api.AdminControllers
{
///
/// 审批轮播
///
[Route("api/admin/slide")]
[ApiController]
[Authorize]
public class AdminSlideController : ControllerBase
{
private readonly ISlideRepository _slideRepository;
public AdminSlideController(ISlideRepository slideRepository)
{
_slideRepository = slideRepository;
}
///
/// 添加轮播
///
///
///
[HttpPost]
public async Task Add([FromBody] Slide request)
{
return await _slideRepository.AddAsync(request);
}
///
/// 修改轮播
///
///
///
[HttpPut]
public async Task Edit([FromBody] Slide request)
{
return await _slideRepository.EditAsync(request);
}
///
/// 列表
///
///
[HttpGet("")]
public async Task> GetList([FromQuery] Slide request)
{
var pagedList = await _slideRepository.GetListAsync();
return pagedList;
}
///
/// 轮播
///
///
[HttpGet("{id}")]
public async Task Get(int id)
{
return await _slideRepository.GetAsync(id);
}
///
/// 删除轮播
///
///
///
[HttpDelete("{id}")]
public async Task Delete(int id)
{
return await _slideRepository.DeleteAsync(id);
}
}
}