1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Repository.Interface.Group;
- using GxPress.Result.Web;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- namespace GxPress.Api.AdminControllers
- {
- /// <summary>
- /// 小组广场
- /// </summary>
- [Route("api/admin/group-categroy")]
- [ApiController]
- [Authorize]
- public class AdminGroupCategroyController : Controller
- {
- private readonly IGroupCategroyRepository groupCategroyRepository;
- public AdminGroupCategroyController(IGroupCategroyRepository groupCategroyRepository)
- {
- this.groupCategroyRepository = groupCategroyRepository;
- }
- /// <summary>
- /// 添加小组广场
- /// </summary>
- /// <param name="groupCategroy"></param>
- /// <returns></returns>
- [HttpPost("add")]
- public async Task<bool> InsertAsync(Entity.tede2.Group.GroupCategroy groupCategroy)
- {
- return await groupCategroyRepository.InsertAsync(groupCategroy) > 0;
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="groupCategroy"></param>
- /// <returns></returns>
- [HttpPut]
- public async Task<bool> UpdateAsync(Entity.tede2.Group.GroupCategroy groupCategroy)
- {
- return await groupCategroyRepository.UpdateAsync(groupCategroy);
- }
- /// <summary>
- /// 根据ID查询详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet("{id}")]
- public async Task<Entity.tede2.Group.GroupCategroy> GetAsync(int id)
- {
- return await groupCategroyRepository.GetAsync(id);
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpDelete]
- public async Task<bool> DeleteAsync(int id)
- {
- return await groupCategroyRepository.DeleteAsync(id);
- }
- /// <summary>
- /// 根据parendId获取
- /// </summary>
- /// <param name="parentId"></param>
- /// <returns></returns>
- [HttpGet("list/{parentId}")]
- public async Task<IEnumerable<GroupCategoryResult>> GetAllAsync(int parentId)
- {
- return await groupCategroyRepository.GetAllAsync(parentId);
- }
- }
- }
|