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 AdminGroupCategoryController : Controller
- {
- private readonly IGroupCategoryRepository groupCategoryRepository;
- public AdminGroupCategoryController(IGroupCategoryRepository GroupCategoryRepository)
- {
- this.groupCategoryRepository = GroupCategoryRepository;
- }
- /// <summary>
- /// 添加小组广场
- /// </summary>
- /// <param name="GroupCategory"></param>
- /// <returns></returns>
- [HttpPost("add")]
- public async Task<bool> InsertAsync(Entity.tede2.Group.GroupCategory GroupCategory)
- {
- return await groupCategoryRepository.InsertAsync(GroupCategory) > 0;
- }
- /// <summary>
- /// 修改
- /// </summary>
- /// <param name="GroupCategory"></param>
- /// <returns></returns>
- [HttpPut]
- public async Task<bool> UpdateAsync(Entity.tede2.Group.GroupCategory GroupCategory)
- {
- return await groupCategoryRepository.UpdateAsync(GroupCategory);
- }
- /// <summary>
- /// 根据ID查询详情
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet("{id}")]
- public async Task<Entity.tede2.Group.GroupCategory> GetAsync(int id)
- {
- return await groupCategoryRepository.GetAsync(id);
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpDelete("{id}")]
- public async Task<bool> DeleteAsync(int id)
- {
- return await groupCategoryRepository.DeleteAsync(id);
- }
- /// <summary>
- /// 根据parendId获取
- /// </summary>
- /// <param name="parentId"></param>
- /// <returns></returns>
- [HttpGet("list/{parentId}")]
- public async Task<IEnumerable<GroupCategoryResult>> GetAllAsync(int parentId)
- {
- return await groupCategoryRepository.GetAllAsync(parentId);
- }
- }
- }
|