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