using System.Collections.Generic; using System.Threading.Tasks; using GxPress.Entity; using GxPress.Repository.Interface; using GxPress.Request.RoleGroup; using GxPress.Result.RoleGroup; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AdminControllers { /// /// 角色组 /// [Route("api/admin/roleGroup")] [ApiController] [Authorize] public class AdminRoleGroupController : ControllerBase { private readonly IRoleGroupRepository _roleGroupRepository; public AdminRoleGroupController(IRoleGroupRepository roleGroupRepository) { _roleGroupRepository = roleGroupRepository; } /// /// 添加 /// /// /// [HttpPost] public async Task Add([FromBody] RoleGroupAddRequest request) { return await _roleGroupRepository.AddAsync(request); } /// /// 修改 /// /// /// /// [HttpPut("{id}")] public async Task Update(int id, [FromBody]RoleGroupAddRequest request) { return await _roleGroupRepository.UpdateAsync(id, request); } /// /// 获取列表 /// /// [HttpGet("list")] public async Task> GetList() { return await _roleGroupRepository.GetDetailListAsync(); } /// /// 删除 /// /// /// [HttpDelete("id")] public async Task Delete(int id) { return await _roleGroupRepository.DeleteAsync(id); } } }