12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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<Slide> Add([FromBody] Slide request)
- {
- return await _slideRepository.AddAsync(request);
- }
-
-
-
-
-
- [HttpPut]
- public async Task<Slide> Edit([FromBody] Slide request)
- {
- return await _slideRepository.EditAsync(request);
- }
-
-
-
-
- [HttpGet("")]
- public async Task<IEnumerable<Slide>> GetList([FromQuery] Slide request)
- {
- var pagedList = await _slideRepository.GetListAsync();
- return pagedList;
- }
-
-
-
-
- [HttpGet("{id}")]
- public async Task<Slide> Get(int id)
- {
- return await _slideRepository.GetAsync(id);
- }
-
-
-
-
-
- [HttpDelete("{id}")]
- public async Task<bool> Delete(int id)
- {
- return await _slideRepository.DeleteAsync(id);
- }
- }
- }
|