using System.Collections.Generic; using System.Threading.Tasks; using GxPress.Repository.Interface.Navigation; using GxPress.Request.Navigation; using GxPress.Result.MiddleLable; using GxPress.Service.Interface.Navigation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace GxPress.Api.AdminControllers { /// /// 导航中间件 /// [Route("api/admin/middle-label")] [ApiController] [Authorize] public class AdminMiddleLableController : ControllerBase { private readonly IMiddleLableRepository middleLableRepository; private readonly IMiddleLableService middleLableService; public AdminMiddleLableController(IMiddleLableRepository middleLableRepository, IMiddleLableService middleLableService) { this.middleLableRepository = middleLableRepository; this.middleLableService = middleLableService; } /// /// 列表 /// /// [HttpGet] public async Task> GetList() { return await middleLableRepository.GetAllAsync(); } /// /// 详情 /// /// /// [HttpGet("{id}")] public async Task GetAsync(int id) { return await middleLableService.GetMiddleLableResultAsync(id); } /// /// 添加导航中间件 /// /// /// /// [HttpPost] public async Task Insert(MiddleLableInRequest request) { return await middleLableService.InsertAsync(request); } /// /// 删除中间件页面 /// /// /// [HttpDelete("{id}")] public async Task Delete(int id) { return await middleLableService.DeleteAsync(id); } /// /// 修改导航中间件 /// /// /// [HttpPut] public async Task Update(MiddleLableUpRequest request) { return await middleLableService.UpdateAsync(request); } } }