1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Entity;
- using GxPress.Repository.Interface;
- using GxPress.Request.ArticleGroup;
- using GxPress.Result.Article;
- using GxPress.Result.ArticleGroupUser;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- namespace GxPress.Api.AdminControllers
- {
- /// <summary>
- /// 文章组
- /// </summary>
- [Route("api/admin/articleGroup")]
- [ApiController]
- [Authorize]
- public class AdminArticleGroupController : Controller
- {
- private readonly IArticleGroupRepository _processGroupRepository;
- public AdminArticleGroupController(IArticleGroupRepository processGroupRepository)
- {
- _processGroupRepository = processGroupRepository;
- }
- /// <summary>
- /// 添加
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPost]
- public async Task<ArticleGroup> Add([FromBody] ArticleGroupAddRequest request)
- {
- return await _processGroupRepository.AddAsync(request);
- }
-
- /// <summary>
- /// 获取详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet("{id}")]
- [AllowAnonymous]
- public async Task<ArticleGroupResult> GetAsync(int id)
- {
- return await _processGroupRepository.GetAsync(id);
- }
- /// <summary>
- /// 列表
- /// </summary>
- /// <returns></returns>
- [HttpGet("list")]
- public async Task<IEnumerable<ArticleGroupUserListResult>> GetList()
- {
- return await _processGroupRepository.GetListAsync(0);
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="id"></param>
- /// <param name="request"></param>
- /// <returns></returns>
- [HttpPut("{id}")]
- public async Task<bool> Update(int id, [FromBody] ArticleGroupAddRequest request)
- {
- return await _processGroupRepository.UpdateAsync(id, request);
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpDelete("{id}")]
- public async Task<bool> Delete(int id)
- {
- return await _processGroupRepository.DeleteAsync(id);
- }
- }
- }
|